mirror of
https://github.com/vim/vim
synced 2025-07-15 16:51:57 +00:00
check.vim: detect trailing whitespace
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@ -4,6 +4,8 @@
|
|||||||
" - All %...s items in "msgid" are identical to the ones in "msgstr".
|
" - All %...s items in "msgid" are identical to the ones in "msgstr".
|
||||||
" - An error or warning code in "msgid" matches the one in "msgstr".
|
" - An error or warning code in "msgid" matches the one in "msgstr".
|
||||||
|
|
||||||
|
" Last Update: 2025 Jul 10
|
||||||
|
|
||||||
if 1 " Only execute this if the eval feature is available.
|
if 1 " Only execute this if the eval feature is available.
|
||||||
|
|
||||||
" using line continuation
|
" using line continuation
|
||||||
@ -207,19 +209,19 @@ let cte = search('^"Content-Transfer-Encoding:\s\+8-bit', 'n')
|
|||||||
let ctc = search('^"Content-Type:.*;\s\+\<charset=[iI][sS][oO]_', 'n')
|
let ctc = search('^"Content-Type:.*;\s\+\<charset=[iI][sS][oO]_', 'n')
|
||||||
let ctu = search('^"Content-Type:.*;\s\+\<charset=utf-8', 'n')
|
let ctu = search('^"Content-Type:.*;\s\+\<charset=utf-8', 'n')
|
||||||
if cte
|
if cte
|
||||||
echomsg "Content-Transfer-Encoding should be 8bit instead of 8-bit"
|
echomsg "Warn: Content-Transfer-Encoding should be 8bit instead of 8-bit"
|
||||||
" TODO: make this an error
|
" TODO: make this an error
|
||||||
" if error == 0
|
" if error == 0
|
||||||
" let error = cte
|
" let error = cte
|
||||||
" endif
|
" endif
|
||||||
elseif ctc
|
elseif ctc
|
||||||
echomsg "Content-Type charset should be 'ISO-...' instead of 'ISO_...'"
|
echomsg "Warn: Content-Type charset should be 'ISO-...' instead of 'ISO_...'"
|
||||||
" TODO: make this an error
|
" TODO: make this an error
|
||||||
" if error == 0
|
" if error == 0
|
||||||
" let error = ct
|
" let error = ct
|
||||||
" endif
|
" endif
|
||||||
elseif ctu
|
elseif ctu
|
||||||
echomsg "Content-Type charset should be 'UTF-8' instead of 'utf-8'"
|
echomsg "Warn: Content-Type charset should be 'UTF-8' instead of 'utf-8'"
|
||||||
" TODO: make this an error
|
" TODO: make this an error
|
||||||
" if error == 0
|
" if error == 0
|
||||||
" let error = ct
|
" let error = ct
|
||||||
@ -229,7 +231,17 @@ endif
|
|||||||
" Check that no lines are longer than 80 chars (except comments)
|
" Check that no lines are longer than 80 chars (except comments)
|
||||||
let overlong = search('^[^#]\%>80v', 'n')
|
let overlong = search('^[^#]\%>80v', 'n')
|
||||||
if overlong > 0
|
if overlong > 0
|
||||||
echomsg "Lines should be wrapped at 80 columns"
|
echomsg "Warn: Lines should be wrapped at 80 columns"
|
||||||
|
" TODO: make this an error
|
||||||
|
" if error == 0
|
||||||
|
" let error = overlong
|
||||||
|
" endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Check that there is no trailing whitespace
|
||||||
|
let overlong = search('\s\+$', 'n')
|
||||||
|
if overlong > 0
|
||||||
|
echomsg $"Warn: Trailing whitespace at line: {overlong}"
|
||||||
" TODO: make this an error
|
" TODO: make this an error
|
||||||
" if error == 0
|
" if error == 0
|
||||||
" let error = overlong
|
" let error = overlong
|
||||||
|
Reference in New Issue
Block a user