From 64929b64d3dd6a6628ffd09021845fd4e636ceb2 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Thu, 30 Apr 2026 13:19:51 +0200 Subject: [PATCH] Skipped more test related JSON files in cfengine lint and format Co-authored-by: Claude Opus 4.6 (1M context) Signed-off-by: Ole Herman Schumacher Elgesem --- src/cfengine_cli/commands.py | 4 ++++ src/cfengine_cli/lint.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/cfengine_cli/commands.py b/src/cfengine_cli/commands.py index 0b373be..92d22d3 100644 --- a/src/cfengine_cli/commands.py +++ b/src/cfengine_cli/commands.py @@ -70,6 +70,10 @@ def _format_dirname(directory: str, line_length: int, check: bool) -> int: continue # Hidden files are ignored by default if name.endswith(".x.cf") or name.endswith(".input.cf"): continue # Test files skipped during directory traversal + if name.endswith( + (".input.json", ".jqinput.json", ".x.json", ".expected.json") + ): + continue # Test files skipped during directory traversal filepath = os.path.join(root, name) if name.endswith(".json") or name.endswith(".cf"): ret |= _format_filename(filepath, line_length, check) diff --git a/src/cfengine_cli/lint.py b/src/cfengine_cli/lint.py index 06af2f4..bdad2a4 100644 --- a/src/cfengine_cli/lint.py +++ b/src/cfengine_cli/lint.py @@ -914,6 +914,14 @@ def _find_filenames_in_arg_folder(arg: str) -> list[str]: files = [f for f in files if not f[0] == "."] # Skip .x.cf files (policy files with intentional errors): files = [f for f in files if not f.endswith(".x.cf")] + # Skip test-related JSON files during directory traversal: + files = [ + f + for f in files + if not f.endswith( + (".input.json", ".jqinput.json", ".x.json", ".expected.json") + ) + ] for name in files: if name.endswith(LINT_EXTENSIONS): results.append(os.path.join(root, name))