Skip to content

feat: add AsciiDoc linter pre-commit hook (#285)#286

Merged
raifdmueller merged 3 commits intodocToolchain:mainfrom
raifdmueller:feature/asciidoc-linter-285
Feb 12, 2026
Merged

feat: add AsciiDoc linter pre-commit hook (#285)#286
raifdmueller merged 3 commits intodocToolchain:mainfrom
raifdmueller:feature/asciidoc-linter-285

Conversation

@raifdmueller
Copy link
Collaborator

Summary

Adds asciidoc-linter as a pre-commit hook to catch AsciiDoc syntax errors before commit. This addresses issue #285.

Changes

1. AsciiDoc Linter Integration

Added:

  • asciidoc-linter as dev dependency (installed from GitHub, not yet on PyPI)
  • Local pre-commit hook in .pre-commit-config.yaml
  • tool.hatch.metadata.allow-direct-references = true to support git dependencies

Runs on: All .adoc and .asciidoc files in the repository

2. Fixed Markdown Tables in ADRs

Converted incorrect Markdown table syntax to proper AsciiDoc format:

Before (Markdown):

| Dimension | Score | Level | Evidence |
|-----------|-------|-------|----------|
| Code Type | 2 | Business Logic | ... |

After (AsciiDoc):

[cols="2,1,2,5"]
|===
| Dimension | Score | Level | Evidence

| Code Type | 2 | Business Logic | ...
|===

Files fixed:

  • src/docs/arc42/adr/ADR-011.adoc
  • src/docs/arc42/adr/ADR-012.adoc

3. Documentation

Updated CLAUDE.md with:

  • AsciiDoc linter setup instructions
  • Known issues (WS001 false positives, Markdown table detection missing)
  • Workaround guide for commits blocked by false positives
  • Explanation of when to use --no-verify

Known Limitations

Linter Issues (reported upstream)

  1. WS001 false positives (asciidoc-linter#41)

    • Incorrectly flags *bold* syntax as list markers
    • All ADR files trigger these warnings
    • Workaround: Use git commit --no-verify when only false positives present
  2. Markdown tables NOT detected (asciidoc-linter#38)

    • Current linter does not catch |---|---| syntax
    • Manual review still required for table syntax
    • Feature request filed upstream

Feature Requests Filed

Also filed upstream enhancement requests:

Testing

Linter verification:

# Test on ADR with known Markdown table (manually found)
uv run asciidoc-linter src/docs/arc42/adr/ADR-011.adoc

# Run pre-commit hook manually
uv run pre-commit run asciidoc-linter --all-files

Results:

Migration Guide

For contributors:

  1. Install dev dependencies:

    uv sync --extra dev
  2. Pre-commit hooks auto-install on first commit

  3. If commit is blocked by WS001 false positives:

    • Review the warnings manually
    • If only false positives (verify *bold* syntax is correct):
      git commit --no-verify -m "your message"
  4. Watch for real errors:

    • Incorrect table syntax (Markdown vs AsciiDoc)
    • Heading hierarchy issues
    • Unterminated blocks

Breaking Changes

None

Related Issues


Generated with 🤖 Claude Code (AI-assisted development)

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

raifdmueller and others added 3 commits February 12, 2026 10:41
Added docToolchain/asciidoc-linter to catch AsciiDoc syntax errors
before commit.

Changes:
- Add asciidoc-linter as dev dependency (from git)
- Configure local pre-commit hook for .adoc files
- Enable direct git references in hatchling config

Limitations:
- Linter does NOT currently detect Markdown tables (issue docToolchain#38)
- Only detects WS001 warnings (missing spaces after markers)
- Requires manual fix of false positives (*bold* vs list markers)

Feature requests filed in asciidoc-linter repo:
- docToolchain#38: Detect Markdown table syntax
- docToolchain#39: Add native pre-commit hooks support (.pre-commit-hooks.yaml)
- docToolchain#40: Publish to PyPI for easier installation

Testing:
- Tested on ADR-011.adoc with known Markdown table (not detected)
- Pre-commit hook runs successfully but needs improvements

Related: docToolchain#285 (parent issue for AsciiDoc linting)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixed incorrect Markdown table syntax in ADR-011 and ADR-012.
Converted to proper AsciiDoc table format with [cols] directive.

Before (Markdown):
| Dimension | Score | Level | Evidence |
|-----------|-------|-------|----------|
| Code Type | 2 | ... | ... |

After (AsciiDoc):
[cols="2,1,2,5"]
|===
| Dimension | Score | Level | Evidence

| Code Type | 2 | ... | ...
|===

Note: The asciidoc-linter does not yet detect this error (issue docToolchain#38).
These were found by manual code review.

Linter status:
- Remaining WS001 warnings are false positives (confuses *bold* with * list)
- Same syntax exists in ADR-001 through ADR-010 (valid AsciiDoc)
- Commit uses --no-verify due to false positives blocking commit

Related: docToolchain#285, docToolchain/asciidoc-linter#38

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added section to CLAUDE.md explaining:
- AsciiDoc linter integration via pre-commit hook
- Known issue: WS001 false positives on *bold* syntax
- Known issue: Markdown tables not detected
- Workaround: Use --no-verify for false positives
- Linter runs on all .adoc files in repository

This helps contributors understand:
- Why commits may be blocked by the linter
- How to distinguish real errors from false positives
- When to use --no-verify safely

Related: docToolchain#285, asciidoc-linter#38, asciidoc-linter#41

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@raifdmueller raifdmueller merged commit 284b446 into docToolchain:main Feb 12, 2026
2 of 3 checks passed
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.

Add AsciiDoc linter as pre-commit hook

1 participant