Repository navigation
Description
Summary
With --also-check-css, the command-line checker reports every HTML and SVG message one line above its true line, so an error on line 1 is reported on line 0. CSS files in the same run report the right line.
URL for document that reproduces the problem
n/a
HTML/CSS/SVG snippet that reproduces the problem
n/aChecker error messages
n/aSpec links/citations
No response
Steps to reproduce
-
Save this as
test.html. The stray</b>is on line 4.<!doctype html> <html lang="en"> <title>Test</title> </b>
-
Run
vnu --format gnu test.html. -
Run
vnu --also-check-css --format gnu test.html.
Expected behavior
Both runs report the error on line 4.
Actual behavior
The second run reports it on line 3:
$ vnu --format gnu test.html
"file:/path/to/test.html":4.1-4.4: error: Stray end tag “b”.
$ vnu --also-check-css --format gnu test.html
"file:/path/to/test.html":3.1-3.4: error: Stray end tag “b”.Every output format shows the same shift, as do stdin, URLs, and SVG files checked with --also-check-svg.
SimpleCommandLineValidator.setup() calls errorHandler.setLineOffset(-1) for the whole run whenever cssCheckingEnabled() is true. That cancels the newline in CSS_CHECKING_PROLOG, so it's right for a wrapped CSS document but wrong for everything else in the run. VerifierServletTransaction sets it only for text/css documents.
Two related things a fix may want to cover:
cssCheckingEnabled()leaves outskipNonCSS, so--skip-non-cssgets no offset: an error on line 2 of a CSS file is reported on line 3.SourceCode.setIsCss()is never undone, so a document checked after a CSS file in the same run keeps the CSS handling. Its messages get a widerextract, withhiliteStart30 rather than 10.
A possible fix, which I haven't built or tested: have MessageEmitterAdapter, which already checks sourceCode.getIsCss() for columns, apply the -1 per document on the same check, drop the two setLineOffset(-1) calls, and clear isCss in checkAsHTML() and checkAsXML(). Setting the offset per file in SimpleCommandLineValidator wouldn't cover URLs, whose content type is only known inside checkHttpURL().
Seen with the latest release, 26.11.3 (93ef029).
Screenshots or screen recordings
No response
Activity
sideshowbarker commentedon Nov 4, 2026
Thanks — all fixed now, and released.
fix: Report the right line numbers when CSS checking is on