-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Improve test_codestyle whitespace testing #18599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing my elementary mistake of using a double quote string on the right hand side of the regular expression match.
5c27006 to
144d35d
Compare
|
It might be better to explicitly match the existing exceptions for the trailing whitespace test ( |
365133a to
f8038ce
Compare
f8038ce to
ddf813f
Compare
Problem: test_codestyle does not catch all unintended whitespace violations in help files. Solution: Improve the relevant patterns. - Don't require a character [^/] before <Space><Tab> so we can match this at the start of a line. - Fix the pattern test for the exception at :help 27.6, this was matching the pattern /[^? ^I]/ rather than the literal text and skipping most of the file. - Add specific test exceptions for all necessary violations. - Use PerformCheck() to process line checks. - Convert file to Vim9 script. Signed-off-by: Doug Kearns <dougkearns@gmail.com>
ddf813f to
1a9340b
Compare
| # break | ||
| # endif | ||
| # endwhile | ||
| # PerformCheck('\%>80v.*$', 'line over 80 columns') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use a skip expression here, so that we don't report errors for overlong lines in helpExamples. Something like this seems to work:
diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim
index 46f839c06..d639b8c7d 100644
--- a/src/testdir/test_codestyle.vim
+++ b/src/testdir/test_codestyle.vim
@@ -107,6 +107,7 @@ enddef
def Test_help_files()
var lnum: number
set nowrapscan
syn on
for fpath in glob('../../runtime/doc/*.txt', 0, 1)
g:ignoreSwapExists = 'e'
@@ -151,15 +152,14 @@ def Test_help_files()
endif
endwhile
cursor(1, 1)
while 1
lnum = search('\%>80v.*$', '', 0, 0, () => synIDattr(synID(line("."), col("."), 1), "name") =~# 'helpExample')
ReportError(fpath, lnum, 'line over 80 columns')
if lnum == 0
break
endif
endwhile
It still reports 296 matches with overlong lines :(
Problem: test_codestyle does not catch all unintended whitespace violations in help files.
Solution: Improve the relevant patterns.
[^/]before<Space><Tab>so we can match this at the start of a line.:help 27.6, this was matching the pattern/[^? ^I]/rather than the literal text and skipping most of the file.PerformCheck()to process line checks.