From 12bd28cab888f857c24f0d0d0ee014c16a4d9589 Mon Sep 17 00:00:00 2001 From: Thomas Jals Date: Thu, 17 Sep 2026 21:39:57 +0200 Subject: [PATCH 1/2] fix(ci,checks): restore CI matrix generation and support collapsible admonitions (#200) - Migrate tox.yml from broken coactions/dynamic-matrix to ansible/actions/matrix@v1 - Fix artifact download merge syntax in CI check job - Add SPHINX_IGNORES_REGEX pattern for :collapsible: option in admonition directives (fixes #200) - Add unit tests in TestValidity verifying sphinx mode behavior - Add uv.lock to .gitignore --- .github/workflows/tox.yml | 18 +++++------------- .gitignore | 1 + src/doc8/checks.py | 4 ++++ src/doc8/tests/test_checks.py | 23 +++++++++++++++++++++++ 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index b531cbd..6a5a588 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Determine matrix id: generate_matrix - uses: coactions/dynamic-matrix@v4 + uses: ansible/actions/matrix@v1 with: min_python: "3.10" max_python: "3.14" @@ -95,9 +95,9 @@ jobs: if: ${{ matrix.command5 }} - name: Archive logs - uses: coactions/upload-artifact@v4 + uses: actions/upload-artifact@v4 with: - name: logs-${{ matrix.name }}.zip + name: logs-${{ matrix.name }} include-hidden-files: true if-no-files-found: ignore path: | @@ -132,20 +132,12 @@ jobs: - run: pip3 install 'coverage>=7.5.1' - - name: Merge logs into a single archive - uses: actions/upload-artifact/merge@v4 - with: - name: logs.zip - include-hidden-files: true - pattern: logs-*.zip - # artifacts like py312.zip and py312-macos do have overlapping files - separate-directories: true - - name: Download artifacts uses: actions/download-artifact@v4 continue-on-error: true # to allow rerunning this job with: - name: logs.zip + pattern: logs-* + merge-multiple: true path: . diff --git a/.gitignore b/.gitignore index 28baac9..145029c 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ src/doc8/_version.py .idea/ .vscode/ junit.xml +uv.lock diff --git a/src/doc8/checks.py b/src/doc8/checks.py index 2b6870f..77ac59f 100644 --- a/src/doc8/checks.py +++ b/src/doc8/checks.py @@ -121,6 +121,10 @@ class CheckValidity(ContentCheck): re.compile( r'^PEP number must be a number from 0 to 9999; "\d{1,4}#[^"]*" is invalid.', ), + re.compile( + r'^Error in "(?:admonition|attention|caution|danger|error|hint|important|note|tip|warning)" directive:\nunknown option: "collapsible"', + re.MULTILINE, + ), ] def __init__(self, cfg): diff --git a/src/doc8/tests/test_checks.py b/src/doc8/tests/test_checks.py index 155c1ff..b4a50cd 100644 --- a/src/doc8/tests/test_checks.py +++ b/src/doc8/tests/test_checks.py @@ -183,3 +183,26 @@ def test_newline(self): check = checks.CheckNewlineEndOfFile({}) errors = list(check.report_iter(parsed_file)) self.assertEqual(expected_errors, len(errors)) + + +class TestValidity(unittest.TestCase): + def test_collapsible_admonition_ignored_in_sphinx_mode(self): + content = b".. note::\n :collapsible:\n\n Collapsible note.\n" + with tempfile.NamedTemporaryFile(suffix=".rst") as fh: + fh.write(content) + fh.flush() + parsed_file = parser.ParsedFile(fh.name) + check = checks.CheckValidity({"sphinx": True}) + errors = list(check.report_iter(parsed_file)) + self.assertEqual(0, len(errors)) + + def test_collapsible_admonition_flagged_without_sphinx_mode(self): + content = b".. note::\n :collapsible:\n\n Collapsible note.\n" + with tempfile.NamedTemporaryFile(suffix=".rst") as fh: + fh.write(content) + fh.flush() + parsed_file = parser.ParsedFile(fh.name) + check = checks.CheckValidity({"sphinx": False}) + errors = list(check.report_iter(parsed_file)) + self.assertEqual(1, len(errors)) + self.assertEqual("D000", errors[0][1]) From 8c5535eafaf8eeba2bf7bd41acb3d7430475c5ae Mon Sep 17 00:00:00 2001 From: Thomas Jals Date: Thu, 17 Sep 2026 21:42:44 +0200 Subject: [PATCH 2/2] fix(ci): update pyupgrade hook for py3.14 compatibility and set fail_ci_if_error: false for codecov --- .github/workflows/tox.yml | 2 +- .pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 6a5a588..13db395 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -146,7 +146,7 @@ jobs: with: name: ${{ matrix.name }} # verbose: true # optional (default = false) - fail_ci_if_error: true + fail_ci_if_error: false use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} # cspell:ignore oidc - name: Decide whether the needed jobs succeeded or failed diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a27605a..53f50e7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: - id: trailing-whitespace - id: check-executables-have-shebangs - repo: https://github.com/asottile/pyupgrade - rev: v3.20.0 + rev: v3.21.2 hooks: - id: pyupgrade - repo: https://github.com/pappasam/toml-sort