-
-
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
h-east
left a comment
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
ddf813f to
1a9340b
Compare
src/testdir/test_codestyle.vim
Outdated
| # 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 :(
1a9340b to
70d34d0
Compare
I only get about 90 and last time I checked most of those were the result of concealed lines being wrapped at their concealed (rendered) length. The prime offenders are long sequences of tags or links, like We need to decide whether we're going to continue with the current policy that seems to favour wrapping at the concealed length. Wrapping at the unconcealed length can make the concealed view look rather odd (e.g., I'm not sure how I got sucked into this... |
Yes, that's what we should do. |
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. - Normalise string delimiters to single quotes. - Convert file to Vim9 script. Signed-off-by: Doug Kearns <[email protected]>
70d34d0 to
70981fb
Compare
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.