Skip to content

tools: fix asciidoclint's silently-disabled checks and clean up the resulting spec violations - #629

Open
Devansh-567 wants to merge 1 commit into
p4lang:mainfrom
Devansh-567:fix-contextskipblocks-listing-detection
Open

tools: fix asciidoclint's silently-disabled checks and clean up the resulting spec violations#629
Devansh-567 wants to merge 1 commit into
p4lang:mainfrom
Devansh-567:fix-contextskipblocks-listing-detection

Conversation

@Devansh-567

Copy link
Copy Markdown
Contributor

Three of asciidoclint.py's checks were silently non-functional against the actual spec document (docs/v1/P4Runtime-Spec.adoc), and no test suite existed to catch it. CI was passing without validating the document.

Bugs Fixed

  1. ContextAfterTitle / ContextSkipHeadings

    • check_line_wraps() and check_keywords() were gated on a [TITLE] sentinel line that does not exist in the spec document.
    • ContextSkipHeadings matched Markdown # headings instead of AsciiDoc = heading syntax.
    • Fix: Updated ContextAfterTitle to match the real document title (^= ...) and ContextSkipHeadings to match AsciiDoc headings (^=+).
  2. check_trailing_whitespace

    • Line indexing (line[-2]) assumed a trailing \n, causing off-by-one errors on final lines lacking a newline.
    • Fix: Strips \n if present before evaluating trailing whitespace.
  3. ContextSkipBlocks

    • Only recognized ~~~~-delimited blocks (0 occurrences in spec) while ignoring ---- listing blocks (216 occurrences), |=== tables (16), and [...] block attributes.
    • Fix: Added tracking for ---- listing blocks, |=== tables, and [...] block attribute lines.

Tests Added

  • Created tools/test_asciidoclint.py covering 17 test cases across all fixed features (title detection, block skipping, trailing whitespace variations).
  • Integrated python3 tools/test_asciidoclint.py -v into the asciidoc-lint CI job.

Spec Document Rewrapping

  • Resolving linter false positives exposed 159 genuine over-length lines in docs/v1/P4Runtime-Spec.adoc.
  • Rewrapped lines using a paragraph/list-aware reflow tool.
  • Verified that content stripped of all whitespace is byte-for-byte identical between the original and updated files.

…butes

Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
@Devansh-567
Devansh-567 force-pushed the fix-contextskipblocks-listing-detection branch from ca7cf77 to c038c8a Compare August 19, 2026 07:00
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.

1 participant