Skip to content

Conversation

@dkearns
Copy link
Contributor

@dkearns dkearns commented Oct 18, 2025

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.

@dkearns dkearns requested a review from h-east October 18, 2025 15:14
Copy link
Member

@h-east h-east left a 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.

@dkearns dkearns force-pushed the fix-help-code-style-exception branch from 5c27006 to 144d35d Compare October 19, 2025 12:41
@dkearns
Copy link
Contributor Author

dkearns commented Oct 19, 2025

It might be better to explicitly match the existing exceptions for the trailing whitespace test (/\~\s\+$/ and /\\\s\+$/), as there's only six matches in total, and simplify the general pattern to /\s\+$/?

@dkearns dkearns force-pushed the fix-help-code-style-exception branch 4 times, most recently from 365133a to f8038ce Compare October 21, 2025 10:10
@dkearns dkearns force-pushed the fix-help-code-style-exception branch from f8038ce to ddf813f Compare October 28, 2025 14:39
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>
@dkearns dkearns force-pushed the fix-help-code-style-exception branch from ddf813f to 1a9340b Compare October 28, 2025 14:40
# break
# endif
# endwhile
# PerformCheck('\%>80v.*$', 'line over 80 columns')
Copy link
Member

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 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants