[vim/vim] Improve test_codestyle whitespace testing (PR #18599)

21 views
Skip to first unread message

dkearns

unread,
Oct 18, 2025, 11:11:30 AMOct 18
to vim/vim, Subscribed

Problem: test_codestyle does not catch all intended 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.
  • Add a specific test exception for :help 12.7.
  • 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.

You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/18599

Commit Summary

  • 5c27006 Improve test_codestyle whitespace testing

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599@github.com>

h_east

unread,
Oct 18, 2025, 12:25:50 PMOct 18
to vim/vim, Subscribed

@h-east approved this pull request.

Thanks for fixing my elementary mistake of using a double quote string on the right hand side of the regular expression match.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/review/3353646688@github.com>

dkearns

unread,
Oct 19, 2025, 8:42:39 AMOct 19
to vim/vim, Push

@dkearns pushed 1 commit.

  • 144d35d Improve test_codestyle whitespace testing


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/before/5c2700684c115fe7118dde0e142794a3794184e4/after/144d35dabbba94d9e58c70a523d523fe1f74528d@github.com>

dkearns

unread,
Oct 19, 2025, 8:54:28 AMOct 19
to vim/vim, Subscribed
dkearns left a comment (vim/vim#18599)

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\+$/?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/c3419644768@github.com>

dkearns

unread,
Oct 20, 2025, 12:19:18 PMOct 20
to vim/vim, Push

@dkearns pushed 1 commit.

  • 7fd3ca1 Improve test_codestyle whitespace testing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/before/144d35dabbba94d9e58c70a523d523fe1f74528d/after/7fd3ca15c1ac157483d4e6cedcecc87530c66655@github.com>

dkearns

unread,
Oct 20, 2025, 12:41:35 PMOct 20
to vim/vim, Push

@dkearns pushed 1 commit.

  • 365133a Improve test_codestyle help file whitespace testing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/before/3259830c5a7c2aec5e5c6fdfd6d4893773438a7e/after/365133a2b3e15df702bdb5f6ee0e00706468191b@github.com>

dkearns

unread,
Oct 21, 2025, 6:11:39 AMOct 21
to vim/vim, Push

@dkearns pushed 1 commit.

  • f8038ce Improve test_codestyle help file whitespace testing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/before/365133a2b3e15df702bdb5f6ee0e00706468191b/after/f8038ceb17bdacf1dbdaf67f7e778820016a1f7e@github.com>

dkearns

unread,
Oct 28, 2025, 10:49:51 AMOct 28
to vim/vim, Push

@dkearns pushed 1 commit.

  • ddf813f Improve test_codestyle help file whitespace testing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/before/f8038ceb17bdacf1dbdaf67f7e778820016a1f7e/after/ddf813f794033d60420a804fbecd09fa34d316e3@github.com>

dkearns

unread,
Oct 28, 2025, 10:49:57 AMOct 28
to vim/vim, Push

@dkearns pushed 1 commit.

  • 1a9340b Improve test_codestyle help file whitespace testing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/before/ddf813f794033d60420a804fbecd09fa34d316e3/after/1a9340bde742c08d287b4c0009243df1dd68657d@github.com>

Christian Brabandt

unread,
Oct 29, 2025, 5:45:15 PM (13 days ago) Oct 29
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In src/testdir/test_codestyle.vim:

>  
 #    # TODO: Check for line over 80 columns
-#    cursor(1, 1)
-#    while 1
-#      lnum = search('\%>80v.*$')
-#      ReportError(fpath, lnum, 'line over 80 columns')
-#      if lnum == 0
-#        break
-#      endif
-#    endwhile
+#    PerformCheck('\%>80v.*$', 'line over 80 columns')

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


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/review/3396429931@github.com>

dkearns

unread,
Nov 7, 2025, 11:48:26 AM (4 days ago) Nov 7
to vim/vim, Push

@dkearns pushed 1 commit.

  • 70d34d0 Improve test_codestyle help file whitespace testing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/before/1a9340bde742c08d287b4c0009243df1dd68657d/after/70d34d05a605abd32b3b85a5cb34b30f96c39831@github.com>

dkearns

unread,
Nov 7, 2025, 11:49:17 AM (4 days ago) Nov 7
to vim/vim, Subscribed
dkearns left a comment (vim/vim#18599)

It still reports 296 matches with overlong lines :(

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 :help :delete, and example markup at the end of the line >.

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 and vice versa.

I'm not sure how I got sucked into this...


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/c3503618488@github.com>

Christian Brabandt

unread,
Nov 9, 2025, 2:28:10 PM (2 days ago) Nov 9
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18599)

We need to decide whether we're going to continue with the current policy that seems to favour wrapping at the concealed length.

Yes, that's what we should do.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/c3508724868@github.com>

dkearns

unread,
Nov 10, 2025, 7:45:26 AM (yesterday) Nov 10
to vim/vim, Push

@dkearns pushed 1 commit.

  • 70981fb Improve test_codestyle help file whitespace testing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18599/before/70d34d05a605abd32b3b85a5cb34b30f96c39831/after/70981fb8f65e3efbf0f95fe503785c573e8c56b2@github.com>

Reply all
Reply to author
Forward
0 new messages