Skip to content

Commit a20223c

Browse files
committed
Use Asciidoctor diagnostics for developer guide linting
1 parent 0238def commit a20223c

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.github/workflows/developer-guide-docs.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,29 @@ jobs:
8484

8585
- name: Install Asciidoctor tooling
8686
run: |
87-
gem install --no-document asciidoctor asciidoctor-pdf asciidoctor-lint
87+
gem install --no-document asciidoctor asciidoctor-pdf rouge
8888
8989
- name: Run Asciidoctor lint
9090
run: |
9191
set -euo pipefail
9292
REPORT_DIR="build/developer-guide/reports"
9393
REPORT_FILE="${REPORT_DIR}/asciidoc-lint-report.txt"
9494
mkdir -p "$REPORT_DIR"
95-
if ! command -v asciidoctor-lint >/dev/null 2>&1; then
96-
echo "asciidoctor-lint is not available" >&2
97-
exit 1
98-
fi
9995
set +e
100-
asciidoctor-lint docs/developer-guide/developer-guide.asciidoc | tee "$REPORT_FILE"
96+
asciidoctor \
97+
--require rouge \
98+
--failure-level WARN \
99+
--verbose \
100+
--trace \
101+
-o /dev/null \
102+
docs/developer-guide/developer-guide.asciidoc \
103+
2>&1 | tee "$REPORT_FILE"
101104
STATUS=${PIPESTATUS[0]}
102105
set -e
103106
echo "ASCII_DOC_LINT_REPORT=$REPORT_FILE" >> "$GITHUB_ENV"
104107
echo "ASCII_DOC_LINT_STATUS=$STATUS" >> "$GITHUB_ENV"
105108
if [ "$STATUS" -ne 0 ]; then
106-
echo "asciidoctor-lint exited with status $STATUS" >&2
109+
echo "Asciidoctor exited with status $STATUS" >&2
107110
fi
108111
109112
- name: Build Developer Guide HTML and PDF

scripts/developer-guide/summarize_reports.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ def summarize_asciidoc(report: Path, status: str, summary_key: str, output: Path
8080
if report.is_file():
8181
text = report.read_text(encoding="utf-8", errors="ignore")
8282

83-
pattern = re.compile(r"^\s*[^:\n]+:\d+:\d+:\s+(ERROR|WARN(?:ING)?|INFO)\b", re.MULTILINE)
83+
pattern = re.compile(
84+
r"^\s*(?:[^:\n]+:\d+:\d+:\s+|asciidoctor:\s+)(ERROR|WARN(?:ING)?|INFO)\b",
85+
re.MULTILINE,
86+
)
8487
matches = pattern.findall(text)
8588

8689
counts = {"error": 0, "warning": 0, "info": 0}
@@ -206,7 +209,7 @@ def parse_args() -> argparse.Namespace:
206209

207210
ascii_parser = subparsers.add_parser(
208211
"ascii",
209-
help="Summarize docToolchain AsciiDoc linter results.",
212+
help="Summarize Asciidoctor diagnostics.",
210213
parents=[common],
211214
)
212215
ascii_parser.add_argument("--report", type=Path, required=True)

0 commit comments

Comments
 (0)