summaryrefslogtreecommitdiff
path: root/scripts/doc-linter.py
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-13 05:36:00 -0700
committerYuriy Andamasov <yuriy@vyos.io>2026-05-13 05:36:00 -0700
commit65a8e9fc9394ff4c9e9fca4000b8ef2681e8d95c (patch)
tree53d8606908f03c5733447a58ea62f9368dd3536b /scripts/doc-linter.py
parent93a5bdc70468ff92196e00783e6871de1891282f (diff)
downloadvyos-documentation-65a8e9fc9394ff4c9e9fca4000b8ef2681e8d95c.tar.gz
vyos-documentation-65a8e9fc9394ff4c9e9fca4000b8ef2681e8d95c.zip
ci(doc-linter): scope to docs/ only — skip repo-root meta files
The linter targets published documentation sources; the auto-discover fallback already walks `docs/` only. CI was passing root-level meta files (README.md, AGENTS.md, .github/copilot-instructions.md — the last is a symlink to AGENTS.md) which forced docs-publication conventions (80-char wrap, RFC IP rules, suppression markers) onto project meta that has no business obeying them. Add an `is_docs_path()` guard in `main()` so the explicit-file-list path matches the auto-discover behavior — only files under `docs/` are linted. AGENTS.md and the Copilot-instruction symlink are now out of scope. Verified: - `python3 scripts/doc-linter.py "['AGENTS.md', 'README.md', '.github/copilot-instructions.md']"` → exit 0 (all skipped). - `python3 scripts/doc-linter.py "['docs/_test_lint.md']"` with a real public IP → still errors as expected. 🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'scripts/doc-linter.py')
-rw-r--r--scripts/doc-linter.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/doc-linter.py b/scripts/doc-linter.py
index 5ccff488..c86ff29a 100644
--- a/scripts/doc-linter.py
+++ b/scripts/doc-linter.py
@@ -29,6 +29,16 @@ NUMBER = r"([\s']\d+[\s'])"
SUPPORTED_EXTS = ('.md', '.rst', '.txt')
+# Linter only applies to published documentation sources under docs/. Repo-root
+# files (README.md, AGENTS.md, .github/copilot-instructions.md) are project
+# meta, not docs content, and are out of scope.
+DOCS_ROOT = 'docs' + os.sep
+
+
+def is_docs_path(path):
+ norm = os.path.normpath(path)
+ return norm == 'docs' or norm.startswith(DOCS_ROOT)
+
# MyST / Markdown fenced code block: leading whitespace + 3+ backticks or 3+ colons.
# Same character and length-or-greater closes.
MD_FENCE_RE = re.compile(r'^(\s*)(`{3,}|:{3,})(.*)$')
@@ -220,7 +230,11 @@ def main():
try:
files = ast.literal_eval(sys.argv[1])
for file in files:
- if file.endswith(SUPPORTED_EXTS) and "_build" not in file:
+ if (
+ file.endswith(SUPPORTED_EXTS)
+ and "_build" not in file
+ and is_docs_path(file)
+ ):
if handle_file_action(file) is False:
bool_error = False
except Exception as e: