From 65a8e9fc9394ff4c9e9fca4000b8ef2681e8d95c Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 13 May 2026 05:36:00 -0700 Subject: ci(doc-linter): scope to docs/ only — skip repo-root meta files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- scripts/doc-linter.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3