summaryrefslogtreecommitdiff
path: root/docs/configuration
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-05-13 20:45:14 +0000
committerClaude <noreply@anthropic.com>2026-05-13 20:45:14 +0000
commit8be6993d1496b0cec62c3a485519f6f915a62ecf (patch)
tree9440b0936815f448c3761791be556a7d8d6ad8bb /docs/configuration
parent36d8f3ee1e0caa54b041e2ee1b16425cf7a3044a (diff)
downloadvyos-documentation-8be6993d1496b0cec62c3a485519f6f915a62ecf.tar.gz
vyos-documentation-8be6993d1496b0cec62c3a485519f6f915a62ecf.zip
doc-linter: narrow argv parsing exception scope to (IndexError, SyntaxError, ValueError)
CodeRabbit / Ruff BLE001: the previous 'except Exception as e:' on the explicit-file-list path caught any error, masking runtime failures from handle_file_action() as silent fallback behavior. Only input validation errors from ast.literal_eval(sys.argv[1]) should trigger the fallback walk. Refactor: - Wrap only the parse step in try/except, catching just IndexError (missing argv[1]), SyntaxError (malformed literal), and ValueError (non-literal input). - On parse failure, set files = None and dispatch to the DOCS_ROOT walk via an explicit 'else' branch. - On parse success, run the file loop outside the try so any errors from handle_file_action() propagate normally and CI fails loudly. Also drops the unused 'as e' (Ruff BLE001 noise) and the implicit catch of TypeError (e.g. ast.literal_eval('42') returns an int and 'for file in 42:' would have been silently swallowed -> fallback walk; now it raises clearly). Verified scenarios: - explicit file list (CI normal path) -> exit 0. - no argv -> IndexError caught -> walks DOCS_ROOT. - malformed argv ('not-a-list') -> SyntaxError caught -> walks DOCS_ROOT. - explicit list with a non-existent file -> FileNotFoundError propagates (previously silently triggered a fallback walk). - explicit list with a non-list literal ('42') -> TypeError propagates (programming error stays visible).
Diffstat (limited to 'docs/configuration')
0 files changed, 0 insertions, 0 deletions