diff options
| author | Claude <noreply@anthropic.com> | 2026-05-13 19:46:51 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-05-13 19:46:51 +0000 |
| commit | ab497bf93ecc769f621b59220d9df1c13d3d2fa1 (patch) | |
| tree | c8af11c524a04f232c00795008226fae7df785cd /docs/_include | |
| parent | 28224f3ad5a62f6e67ce438c243f38c63583f0b6 (diff) | |
| download | vyos-documentation-ab497bf93ecc769f621b59220d9df1c13d3d2fa1.tar.gz vyos-documentation-ab497bf93ecc769f621b59220d9df1c13d3d2fa1.zip | |
doc-linter: handle absolute paths in is_docs_path()
CodeRabbit review on 28224f3 flagged that is_docs_path() introduced
in 65a8e9f only matched repo-relative path strings. An absolute path
to docs/... (e.g., from a local invocation that pre-resolves paths,
or from tooling that uses git ls-files --full-path) would silently
fail the docs/ check and the file would be skipped.
Rewrite the helper to use os.path.commonpath against an absolute
docs/ root computed on each call. Both inputs are normalized to
absolute form, so repo-relative and absolute callers produce the
same result. ValueError from commonpath (mixed Windows drives or
empty input) is caught and treated as 'not a docs path'.
abs_docs is recomputed per call rather than captured at import time
so the helper picks up the actual cwd at invocation, matching the
existing assumption that CI / local runs invoke the linter from the
repo root.
Verified against 12 edge cases:
- repo-relative docs paths (docs, docs/foo.md, docs/sub/dir/foo.md,
./docs/foo.md) -> True.
- repo-relative meta paths (AGENTS.md, README.md,
.github/copilot-instructions.md, docs_other/foo.md) -> False.
- absolute paths inside docs/ -> True; inside repo root but outside
docs/ -> False.
- traversal attempts (../other/foo.md, docs/../AGENTS.md) -> False.
CI behavior unchanged: tj-actions/changed-files passes repo-relative
paths, which were already handled by the previous logic.
Diffstat (limited to 'docs/_include')
0 files changed, 0 insertions, 0 deletions
