Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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: .


Expand All @@ -154,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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ src/doc8/_version.py
.idea/
.vscode/
junit.xml
uv.lock
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/doc8/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
23 changes: 23 additions & 0 deletions src/doc8/tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Loading