Markdown-Checker 1.2.0__tar.gz → 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/PKG-INFO +2 -2
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/README.md +1 -1
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/howto/github-actions.rst +5 -5
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/reference/report-formats.rst +1 -1
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/pyproject.toml +1 -1
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/__init__.py +1 -1
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/models/url.py +2 -2
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/annotations.py +3 -2
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/markdown.py +3 -3
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/conftest.py +1 -1
- markdown_checker-1.2.1/tests/reports/renderers/test_annotations.py +35 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/renderers/test_json.py +1 -1
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/renderers/test_markdown.py +23 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/test_cli.py +1 -1
- markdown_checker-1.2.0/tests/reports/renderers/test_annotations.py +0 -15
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/LICENSE +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/CODE_OF_CONDUCT.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/CONTRIBUTING.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/api/checker.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/api/checks.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/api/cli.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/api/main.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/api/models.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/api/patterns.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/api/reports.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/api/utils.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/changes.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/conf.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/explanation/index.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/explanation/link-detection.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/explanation/url-checking.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/howto/index.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/howto/pyproject-config.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/howto/rate-limits.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/howto/report-formats.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/howto/select-files.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/howto/shell-completions.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/howto/skip-links.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/index.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/license.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/reference/checks.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/reference/cli.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/reference/configuration.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/reference/exit-codes.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/reference/index.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/docs/tutorial.rst +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checker.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checks/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checks/base.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checks/broken_paths.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checks/broken_urls.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checks/locale.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checks/tracking.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/cli.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/models/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/models/base.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/models/config.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/models/path.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/patterns.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/py.typed +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/base.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/model.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/registry.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/console.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/json.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/templates/paths/broken.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/templates/paths/tracking.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/templates/urls/broken.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/templates/urls/locale.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/templates/urls/tracking.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/writer.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/extract_links.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/github_env.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/list_files.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/pyproject_config.py +1 -1
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/spinner.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/url_pipeline.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/checks/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/checks/test_base.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/checks/test_broken_paths.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/checks/test_broken_urls.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/checks/test_checks.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/checks/test_locale.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/checks/test_tracking.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/conftest.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/models/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/models/test_base.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/models/test_config.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/models/test_models.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/models/test_path.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/models/test_url.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/renderers/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/renderers/test_console.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/renderers/test_renderers.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/test_base.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/test_model.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/test_registry.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/test_reports.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/reports/test_writer.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/resources/sample1.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/resources/sample2.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/resources/sample3.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/resources/sample4.md +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/smoke/test_cli_smoke.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/test_checker.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/test_markdown_checker.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/test_patterns.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/utils/__init__.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/utils/test_extract_links.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/utils/test_github_env.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/utils/test_list_files.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/utils/test_pyproject_config.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/utils/test_spinner.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/utils/test_url_pipeline.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/tests/utils/test_utils.py +0 -0
- {markdown_checker-1.2.0 → markdown_checker-1.2.1}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: markdown-checker
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: A markdown link validation reporting tool.
|
|
5
5
|
Author-email: John Aziz <johnaziz269@gmail.com>
|
|
6
6
|
Maintainer-email: John Aziz <johnaziz269@gmail.com>
|
|
@@ -87,7 +87,7 @@ Run this tool within a GitHub workflow using the
|
|
|
87
87
|
GitHub Action, which posts the report as a pull request comment:
|
|
88
88
|
|
|
89
89
|
```yaml
|
|
90
|
-
- uses: john0isaac/action-check-markdown@v1.
|
|
90
|
+
- uses: john0isaac/action-check-markdown@v1.2.0
|
|
91
91
|
with:
|
|
92
92
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
93
93
|
command: check_broken_paths
|
|
@@ -58,7 +58,7 @@ Run this tool within a GitHub workflow using the
|
|
|
58
58
|
GitHub Action, which posts the report as a pull request comment:
|
|
59
59
|
|
|
60
60
|
```yaml
|
|
61
|
-
- uses: john0isaac/action-check-markdown@v1.
|
|
61
|
+
- uses: john0isaac/action-check-markdown@v1.2.0
|
|
62
62
|
with:
|
|
63
63
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
64
64
|
command: check_broken_paths
|
|
@@ -34,15 +34,15 @@ replacing ``guide-url`` with the URL of your own contribution guide:
|
|
|
34
34
|
pull-requests: write
|
|
35
35
|
contents: read
|
|
36
36
|
steps:
|
|
37
|
-
- uses: actions/checkout@
|
|
38
|
-
- uses: john0isaac/action-check-markdown@v1.
|
|
37
|
+
- uses: actions/checkout@v7
|
|
38
|
+
- uses: john0isaac/action-check-markdown@v1.2.0
|
|
39
39
|
with:
|
|
40
40
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
41
41
|
command: check_broken_paths
|
|
42
42
|
directory: ./
|
|
43
43
|
guide-url: "https://github.com/<owner>/<repo>/blob/main/CONTRIBUTING.md"
|
|
44
44
|
|
|
45
|
-
The ``command`` input selects which check to run. As of v1.
|
|
45
|
+
The ``command`` input selects which check to run. As of v1.2.0 the action
|
|
46
46
|
supports ``check_broken_paths``, ``check_paths_tracking``,
|
|
47
47
|
``check_urls_tracking``, and ``check_urls_locale`` - **not**
|
|
48
48
|
``check_broken_urls``. Add a separate job (or step) per command if you want
|
|
@@ -64,8 +64,8 @@ annotations on the PR diff, the same way the action's output does:
|
|
|
64
64
|
permissions:
|
|
65
65
|
contents: read
|
|
66
66
|
steps:
|
|
67
|
-
- uses: actions/checkout@
|
|
68
|
-
- uses: actions/setup-python@
|
|
67
|
+
- uses: actions/checkout@v7
|
|
68
|
+
- uses: actions/setup-python@v6
|
|
69
69
|
with:
|
|
70
70
|
python-version: "3.11"
|
|
71
71
|
- run: pip install markdown-checker
|
|
@@ -46,7 +46,7 @@ A structured document including both errors and warnings:
|
|
|
46
46
|
.. code-block:: json
|
|
47
47
|
|
|
48
48
|
{
|
|
49
|
-
"tool": {"name": "markdown-checker", "version": "1.2.
|
|
49
|
+
"tool": {"name": "markdown-checker", "version": "1.2.1"},
|
|
50
50
|
"check": "check_broken_urls",
|
|
51
51
|
"summary": {
|
|
52
52
|
"files_checked": 10,
|
|
@@ -2,7 +2,7 @@ import email.utils
|
|
|
2
2
|
import time
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from datetime import datetime
|
|
5
|
-
from datetime import
|
|
5
|
+
from datetime import UTC
|
|
6
6
|
from typing import Literal
|
|
7
7
|
from urllib.parse import ParseResult
|
|
8
8
|
from urllib.parse import urlparse
|
|
@@ -65,7 +65,7 @@ def _retry_after_delay(response: httpx2.Response, fallback: int) -> float | None
|
|
|
65
65
|
# Try HTTP-date format (e.g. "Wed, 21 Oct 2015 07:28:00 GMT").
|
|
66
66
|
try:
|
|
67
67
|
dt: datetime = email.utils.parsedate_to_datetime(header)
|
|
68
|
-
now: datetime = datetime.now(
|
|
68
|
+
now: datetime = datetime.now(UTC)
|
|
69
69
|
delay: float = (dt - now).total_seconds()
|
|
70
70
|
return max(0.0, delay)
|
|
71
71
|
except Exception:
|
|
@@ -12,9 +12,10 @@ from markdown_checker.reports.model import ReportIssue
|
|
|
12
12
|
|
|
13
13
|
def _annotation_line(issue: ReportIssue) -> str:
|
|
14
14
|
level = "warning" if issue.level == "warning" else "error"
|
|
15
|
+
file_path = issue.file_path.as_posix()
|
|
15
16
|
return (
|
|
16
|
-
f"::{level} file={
|
|
17
|
-
f"File {
|
|
17
|
+
f"::{level} file={file_path},line={issue.line_number}::"
|
|
18
|
+
f"File {file_path}, line {issue.line_number}, "
|
|
18
19
|
f"Link {issue.link} {issue.message}."
|
|
19
20
|
)
|
|
20
21
|
|
{markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/markdown.py
RENAMED
|
@@ -69,7 +69,7 @@ class MarkdownRenderer(ReportRenderer):
|
|
|
69
69
|
def _file_link(self, file_path: Path, context: ReportContext) -> str | None:
|
|
70
70
|
if context.output_mode == "ci":
|
|
71
71
|
return _repo_file_link(context.repo_url, file_path) if context.repo_url else None
|
|
72
|
-
return
|
|
72
|
+
return file_path.as_posix()
|
|
73
73
|
|
|
74
74
|
def _format_issue_rows(self, issues: tuple[ReportIssue, ...], context: ReportContext) -> str:
|
|
75
75
|
parts: list[str] = ["<table><thead><tr><th>#</th><th>Link</th><th>Line Number</th></tr></thead><tbody>"]
|
|
@@ -94,9 +94,9 @@ class MarkdownRenderer(ReportRenderer):
|
|
|
94
94
|
file_link = self._file_link(file_report.file_path, context)
|
|
95
95
|
issue_rows = self._format_issue_rows(file_report.errors, context)
|
|
96
96
|
if file_link is None:
|
|
97
|
-
rows.append(f"| `{file_report.file_path}` |" + issue_rows)
|
|
97
|
+
rows.append(f"| `{file_report.file_path.as_posix()}` |" + issue_rows)
|
|
98
98
|
else:
|
|
99
|
-
rows.append(f"| [`{file_report.file_path}`]({file_link}) |" + issue_rows)
|
|
99
|
+
rows.append(f"| [`{file_report.file_path.as_posix()}`]({file_link}) |" + issue_rows)
|
|
100
100
|
return "| File Full Path | Issues |\n|--------|--------|\n" + "".join(rows)
|
|
101
101
|
|
|
102
102
|
def render(self, report: Report) -> str:
|
|
@@ -32,5 +32,5 @@ def sample_report():
|
|
|
32
32
|
),
|
|
33
33
|
),
|
|
34
34
|
)
|
|
35
|
-
context = ReportContext(check_name="check_broken_urls", tool_version="1.2.
|
|
35
|
+
context = ReportContext(check_name="check_broken_urls", tool_version="1.2.1")
|
|
36
36
|
return Report(context=context, files=(file_report,), links_checked=2, files_checked=1)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from pathlib import PureWindowsPath
|
|
2
|
+
|
|
3
|
+
from markdown_checker.reports.model import FileReport
|
|
4
|
+
from markdown_checker.reports.model import Report
|
|
5
|
+
from markdown_checker.reports.model import ReportContext
|
|
6
|
+
from markdown_checker.reports.model import ReportIssue
|
|
7
|
+
from markdown_checker.reports.renderers.annotations import GitHubAnnotationsRenderer
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_github_annotations_renderer_formats_errors_and_warnings(sample_report):
|
|
11
|
+
"""GitHubAnnotationsRenderer emits one ::error/::warning line per issue."""
|
|
12
|
+
result = GitHubAnnotationsRenderer().render(sample_report)
|
|
13
|
+
assert "::error file=docs/usage.rst,line=42::" in result
|
|
14
|
+
assert "::warning file=docs/usage.rst,line=7::" in result
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_github_annotations_renderer_render_lines_levels(sample_report):
|
|
18
|
+
"""render_lines returns (text, level) pairs matching issue levels."""
|
|
19
|
+
lines = GitHubAnnotationsRenderer().render_lines(sample_report)
|
|
20
|
+
levels = {level for _, level in lines}
|
|
21
|
+
assert levels == {"error", "warning"}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_github_annotations_renderer_windows_path_uses_forward_slashes():
|
|
25
|
+
"""A Windows-style file path is rendered with forward slashes in the `file=` annotation
|
|
26
|
+
field, so GitHub can correctly link the annotation back to the file."""
|
|
27
|
+
file_path = PureWindowsPath(r"content\6502_Assembly_Code\README.md")
|
|
28
|
+
issue = ReportIssue(link="./missing.md", line_number=3, file_path=file_path, message="is broken", level="error")
|
|
29
|
+
report = Report(
|
|
30
|
+
context=ReportContext(check_name="check_broken_paths", output_mode="ci"),
|
|
31
|
+
files=(FileReport(file_path=file_path, errors=(issue,)),),
|
|
32
|
+
)
|
|
33
|
+
result = GitHubAnnotationsRenderer().render(report)
|
|
34
|
+
assert "file=content/6502_Assembly_Code/README.md,line=3" in result
|
|
35
|
+
assert "\\" not in result
|
|
@@ -16,7 +16,7 @@ def test_json_renderer_produces_valid_json(sample_report):
|
|
|
16
16
|
def test_json_renderer_includes_tool_version(sample_report):
|
|
17
17
|
"""JsonRenderer includes tool metadata from the report context."""
|
|
18
18
|
data = json.loads(JsonRenderer().render(sample_report))
|
|
19
|
-
assert data["tool"]["version"] == "1.2.
|
|
19
|
+
assert data["tool"]["version"] == "1.2.1"
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def test_json_renderer_respects_custom_indent(sample_report):
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
+
from pathlib import PureWindowsPath
|
|
2
3
|
|
|
3
4
|
import pytest
|
|
4
5
|
|
|
@@ -190,6 +191,28 @@ def test_issues_table_ci_mode_with_repo_url_has_clickable_links(two_errors):
|
|
|
190
191
|
assert "[`file.md`](https://github.com/owner/repo/blob/sha/file.md)" in result
|
|
191
192
|
|
|
192
193
|
|
|
194
|
+
def test_issues_table_local_mode_windows_path_uses_forward_slashes():
|
|
195
|
+
"""A Windows-style file path is rendered with forward slashes, not backslashes, so the
|
|
196
|
+
link resolves correctly when viewed on GitHub (backslashes get percent-encoded there)."""
|
|
197
|
+
file_path = PureWindowsPath(r"content\6502_Assembly_Code\README.md")
|
|
198
|
+
issue = ReportIssue(link="./missing.md", line_number=1, file_path=file_path, message="is broken", level="error")
|
|
199
|
+
context = ReportContext(check_name="check_broken_paths", output_mode="local")
|
|
200
|
+
files = (_errors_file_report(file_path, (issue,)),)
|
|
201
|
+
result = MarkdownRenderer()._format_issues_table(files, context)
|
|
202
|
+
assert "[`content/6502_Assembly_Code/README.md`](content/6502_Assembly_Code/README.md)" in result
|
|
203
|
+
assert "\\" not in result
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def test_issue_rows_local_mode_windows_path_uses_forward_slashes():
|
|
207
|
+
"""The per-issue line-number link also uses forward slashes for a Windows-style path."""
|
|
208
|
+
file_path = PureWindowsPath(r"content\6502_Assembly_Code\README.md")
|
|
209
|
+
issue = ReportIssue(link="./missing.md", line_number=5, file_path=file_path, message="is broken", level="error")
|
|
210
|
+
context = ReportContext(check_name="check_broken_paths", output_mode="local")
|
|
211
|
+
result = MarkdownRenderer()._format_issue_rows((issue,), context)
|
|
212
|
+
assert "content/6502_Assembly_Code/README.md#L5" in result
|
|
213
|
+
assert "\\" not in result
|
|
214
|
+
|
|
215
|
+
|
|
193
216
|
def test_issues_table_skips_files_without_errors(two_errors):
|
|
194
217
|
"""Files with only warnings (no errors) are omitted from the table."""
|
|
195
218
|
context = ReportContext(check_name="check_broken_urls")
|
|
@@ -138,7 +138,7 @@ def test_cli_version(runner):
|
|
|
138
138
|
"""Displays version information."""
|
|
139
139
|
result = runner.invoke(main, ["--version"])
|
|
140
140
|
assert result.exit_code == 0
|
|
141
|
-
assert "1.2.
|
|
141
|
+
assert "1.2.1" in result.output
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
def test_cli_ci_mode(runner, resources_dir, monkeypatch, tmp_path):
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from markdown_checker.reports.renderers.annotations import GitHubAnnotationsRenderer
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_github_annotations_renderer_formats_errors_and_warnings(sample_report):
|
|
5
|
-
"""GitHubAnnotationsRenderer emits one ::error/::warning line per issue."""
|
|
6
|
-
result = GitHubAnnotationsRenderer().render(sample_report)
|
|
7
|
-
assert "::error file=docs/usage.rst,line=42::" in result
|
|
8
|
-
assert "::warning file=docs/usage.rst,line=7::" in result
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def test_github_annotations_renderer_render_lines_levels(sample_report):
|
|
12
|
-
"""render_lines returns (text, level) pairs matching issue levels."""
|
|
13
|
-
lines = GitHubAnnotationsRenderer().render_lines(sample_report)
|
|
14
|
-
levels = {level for _, level in lines}
|
|
15
|
-
assert levels == {"error", "warning"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checks/broken_paths.py
RENAMED
|
File without changes
|
{markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/checks/broken_urls.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/__init__.py
RENAMED
|
File without changes
|
{markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/console.py
RENAMED
|
File without changes
|
{markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/reports/renderers/json.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/extract_links.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_checker-1.2.0 → markdown_checker-1.2.1}/src/markdown_checker/utils/url_pipeline.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|