project-checks 0.2.2__tar.gz → 0.2.3__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.
- {project_checks-0.2.2 → project_checks-0.2.3}/PKG-INFO +1 -1
- {project_checks-0.2.2 → project_checks-0.2.3}/pyproject.toml +1 -1
- {project_checks-0.2.2 → project_checks-0.2.3}/src/project_checks/markdown_claims.py +3 -2
- {project_checks-0.2.2 → project_checks-0.2.3}/tests/test_markdown_claims.py +31 -0
- {project_checks-0.2.2 → project_checks-0.2.3}/.gitignore +0 -0
- {project_checks-0.2.2 → project_checks-0.2.3}/README.md +0 -0
- {project_checks-0.2.2 → project_checks-0.2.3}/src/project_checks/__init__.py +0 -0
- {project_checks-0.2.2 → project_checks-0.2.3}/src/project_checks/change_impact.py +0 -0
- {project_checks-0.2.2 → project_checks-0.2.3}/src/project_checks/diagnostics.py +0 -0
- {project_checks-0.2.2 → project_checks-0.2.3}/src/project_checks/generated_file_guard.py +0 -0
- {project_checks-0.2.2 → project_checks-0.2.3}/src/project_checks/repo_context.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: project-checks
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Run conservative project diagnostics.
|
|
5
5
|
Project-URL: Homepage, https://github.com/lewishowles/dev-tools/tree/main/packages/project-checks
|
|
6
6
|
Project-URL: Repository, https://github.com/lewishowles/dev-tools
|
|
@@ -88,7 +88,8 @@ def extract_link_claims(text: str, source_file: Path) -> list[tuple[str, Path]]:
|
|
|
88
88
|
target = m.group(1).strip()
|
|
89
89
|
if target.startswith(("http://", "https://", "#", "mailto:", "/")):
|
|
90
90
|
continue
|
|
91
|
-
|
|
91
|
+
path_target = target.split("#", maxsplit=1)[0]
|
|
92
|
+
resolved = (source_file.parent / path_target).resolve()
|
|
92
93
|
claims.append((target, resolved))
|
|
93
94
|
return claims
|
|
94
95
|
|
|
@@ -209,7 +210,7 @@ def check_commands(
|
|
|
209
210
|
):
|
|
210
211
|
if not resolved.exists():
|
|
211
212
|
issues.append(Issue(file=rel, claim=claim, kind="missing_script"))
|
|
212
|
-
elif not resolved.stat().st_mode & 0o111:
|
|
213
|
+
elif resolved.suffix == ".sh" and not resolved.stat().st_mode & 0o111:
|
|
213
214
|
issues.append(Issue(file=rel, claim=claim, kind="not_executable"))
|
|
214
215
|
|
|
215
216
|
return issues
|
|
@@ -5,6 +5,7 @@ import pytest
|
|
|
5
5
|
|
|
6
6
|
from project_checks.markdown_claims import (
|
|
7
7
|
DEFAULT_REPO_PATH_PREFIXES,
|
|
8
|
+
Issue,
|
|
8
9
|
MARKDOWN_SCAN_IGNORE_DIRS,
|
|
9
10
|
check_commands,
|
|
10
11
|
check_paths,
|
|
@@ -301,3 +302,33 @@ def test_missing_config_uses_default_prefixes(tmp_path: Path) -> None:
|
|
|
301
302
|
|
|
302
303
|
def test_missing_config_uses_default_ignore_dirs(tmp_path: Path) -> None:
|
|
303
304
|
assert load_ignore_dirs(tmp_path / "missing.json") == MARKDOWN_SCAN_IGNORE_DIRS
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
def test_relative_link_with_fragment_validates_the_path_before_fragment(
|
|
308
|
+
tmp_path: Path,
|
|
309
|
+
) -> None:
|
|
310
|
+
manual = tmp_path / "references" / "manual-checks.md"
|
|
311
|
+
manual.parent.mkdir()
|
|
312
|
+
manual.write_text("# Component states\n", encoding="utf-8")
|
|
313
|
+
(tmp_path / "README.md").write_text(
|
|
314
|
+
"[Manual](references/manual-checks.md#component-states)\n",
|
|
315
|
+
encoding="utf-8",
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
assert check_paths(tmp_path) == []
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def test_command_claims_require_shell_scripts_to_be_executable(tmp_path: Path) -> None:
|
|
322
|
+
scripts_dir = tmp_path / "scripts"
|
|
323
|
+
scripts_dir.mkdir()
|
|
324
|
+
(scripts_dir / "check.py").write_text("print('checked')\n", encoding="utf-8")
|
|
325
|
+
(scripts_dir / "check.sh").write_text("#!/bin/sh\n", encoding="utf-8")
|
|
326
|
+
(tmp_path / "README.md").write_text(
|
|
327
|
+
"Run `scripts/check.py`, `scripts/check.sh`, or `scripts/missing.sh`.\n",
|
|
328
|
+
encoding="utf-8",
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
assert check_commands(tmp_path) == [
|
|
332
|
+
Issue(file="README.md", claim="scripts/check.sh", kind="not_executable"),
|
|
333
|
+
Issue(file="README.md", claim="scripts/missing.sh", kind="missing_script"),
|
|
334
|
+
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|