Skip to content

Commit 284b446

Browse files
raifdmuellerclaude
andauthored
feat: add AsciiDoc linter pre-commit hook (#285) (#286)
* chore: add AsciiDoc linter as pre-commit hook 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 #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: - #38: Detect Markdown table syntax - #39: Add native pre-commit hooks support (.pre-commit-hooks.yaml) - #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: #285 (parent issue for AsciiDoc linting) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: convert Markdown tables to AsciiDoc syntax in ADRs 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 #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: #285, docToolchain/asciidoc-linter#38 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * docs: document AsciiDoc linter setup and known issues 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: #285, asciidoc-linter#38, asciidoc-linter#41 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 7dca913 commit 284b446

File tree

6 files changed

+78
-14
lines changed

6 files changed

+78
-14
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ repos:
2525
- id: check-merge-conflict
2626
- id: check-toml
2727
- id: mixed-line-ending
28+
29+
# AsciiDoc linter (local hook - requires dev dependencies)
30+
- repo: local
31+
hooks:
32+
- id: asciidoc-linter
33+
name: AsciiDoc Linter
34+
entry: uv run asciidoc-linter
35+
language: system
36+
files: \.(adoc|asciidoc)$
37+
args: [--format, plain]

CLAUDE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,40 @@ Development happens on a fork to keep `upstream/main` stable for `uv tool instal
6464
- Documentation, Issues, Pull-Requests etc. is always written in english
6565
- use responsible-vibe-mcp wherever suitable
6666

67+
### AsciiDoc Linting
68+
69+
The project uses [asciidoc-linter](https://github.com/docToolchain/asciidoc-linter) as a pre-commit hook to catch AsciiDoc syntax errors.
70+
71+
**Known Issues (as of 2026-02-11):**
72+
73+
- **WS001 false positives**: Linter incorrectly flags `*bold*` and `**bold**` syntax as list markers needing spaces
74+
- These warnings can be safely ignored - the syntax is correct AsciiDoc
75+
- See [asciidoc-linter#41](https://github.com/docToolchain/asciidoc-linter/issues/41)
76+
- All ADR files (ADR-001 through ADR-013) trigger these false positives
77+
78+
- **Markdown tables NOT detected**: Linter does not catch Markdown table syntax (`|---|---|`) in AsciiDoc files
79+
- See [asciidoc-linter#38](https://github.com/docToolchain/asciidoc-linter/issues/38)
80+
- Manual review required for table syntax
81+
82+
**Workaround for commits:**
83+
84+
When committing changes to `.adoc` files, the pre-commit hook may fail due to WS001 false positives:
85+
86+
```bash
87+
# If only false positives (verify manually):
88+
git commit --no-verify -m "your message"
89+
90+
# Or fix the linter output and commit normally
91+
git commit -m "your message"
92+
```
93+
94+
**Real errors to watch for:**
95+
- Incorrect table syntax (Markdown vs AsciiDoc)
96+
- Heading hierarchy issues (HEAD001-003)
97+
- Unterminated blocks (BLOCK001)
98+
99+
The linter runs on **all `.adoc` and `.asciidoc` files** in the repository.
100+
67101
## Commands
68102

69103
```bash

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Issues = "https://github.com/docToolchain/dacli/issues"
3535

3636
[project.optional-dependencies]
3737
dev = [
38+
"asciidoc-linter @ git+https://github.com/docToolchain/asciidoc-linter.git",
3839
"hypothesis>=6.0.0",
3940
"pre-commit>=4.0.0",
4041
"pytest>=8.0.0",
@@ -55,6 +56,9 @@ build-backend = "hatchling.build"
5556
[tool.hatch.build.targets.wheel]
5657
packages = ["src/dacli"]
5758

59+
[tool.hatch.metadata]
60+
allow-direct-references = true
61+
5862
[tool.pytest.ini_options]
5963
testpaths = ["tests"]
6064
pythonpath = ["src"]

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88

99
The dacli CLI module requires risk classification according to the Risk Radar framework to determine appropriate security and quality assurance measures. The assessment evaluates five dimensions:
1010

11-
| Dimension | Score | Level | Evidence |
12-
|-----------|-------|-------|----------|
13-
| Code Type | 2 | Business Logic | Click commands, service layer orchestration (`src/dacli/cli.py`, `src/dacli/services/`) |
14-
| Language | 2 | Dynamically typed | Python 3.12+ — 100% `.py` files |
15-
| Deployment | 1 | Internal tool | Command-line tool for documentation teams |
16-
| Data Sensitivity | 1 | Internal business data | Operates on internal documentation |
17-
| Blast Radius | 2 | Data loss (recoverable) | Could corrupt docs, recoverable from git |
11+
[cols="2,1,2,5"]
12+
|===
13+
| Dimension | Score | Level | Evidence
14+
15+
| Code Type | 2 | Business Logic | Click commands, service layer orchestration (`src/dacli/cli.py`, `src/dacli/services/`)
16+
| Language | 2 | Dynamically typed | Python 3.12+ — 100% `.py` files
17+
| Deployment | 1 | Internal tool | Command-line tool for documentation teams
18+
| Data Sensitivity | 1 | Internal business data | Operates on internal documentation
19+
| Blast Radius | 2 | Data loss (recoverable) | Could corrupt docs, recoverable from git
20+
|===
1821

1922
*Decision:*
2023

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88

99
The dacli-mcp MCP server module requires risk classification according to the Risk Radar framework to determine appropriate security and quality assurance measures. The assessment evaluates five dimensions:
1010

11-
| Dimension | Score | Level | Evidence |
12-
|-----------|-------|-------|----------|
13-
| Code Type | 2 | Business Logic | MCP tools, service layer (`src/dacli/mcp_app.py`, `src/dacli/services/`) |
14-
| Language | 2 | Dynamically typed | Python 3.12+ — 100% `.py` files |
15-
| Deployment | 1 | Internal tool | MCP server for LLM integration in internal workflows |
16-
| Data Sensitivity | 1 | Internal business data | Operates on internal documentation |
17-
| Blast Radius | 2 | Data loss (recoverable) | Could corrupt docs, recoverable from git |
11+
[cols="2,1,2,5"]
12+
|===
13+
| Dimension | Score | Level | Evidence
14+
15+
| Code Type | 2 | Business Logic | MCP tools, service layer (`src/dacli/mcp_app.py`, `src/dacli/services/`)
16+
| Language | 2 | Dynamically typed | Python 3.12+ — 100% `.py` files
17+
| Deployment | 1 | Internal tool | MCP server for LLM integration in internal workflows
18+
| Data Sensitivity | 1 | Internal business data | Operates on internal documentation
19+
| Blast Radius | 2 | Data loss (recoverable) | Could corrupt docs, recoverable from git
20+
|===
1821

1922
**Note:** Initial consideration was given to Code Type score 3 (API/Database Queries) since the module exposes API endpoints (MCP tools). However, user confirmed score 2 as these are internal service APIs without public exposure or direct database access.
2023

uv.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)