Skip to content

Commit 765f59a

Browse files
authored
Merge pull request #96 from olehermanse/cpt
Skipped more test related JSON files in cfengine lint and format
2 parents bb8e305 + 64929b6 commit 765f59a

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/cfengine_cli/commands.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ def _format_dirname(directory: str, line_length: int, check: bool) -> int:
7070
continue # Hidden files are ignored by default
7171
if name.endswith(".x.cf") or name.endswith(".input.cf"):
7272
continue # Test files skipped during directory traversal
73+
if name.endswith(
74+
(".input.json", ".jqinput.json", ".x.json", ".expected.json")
75+
):
76+
continue # Test files skipped during directory traversal
7377
filepath = os.path.join(root, name)
7478
if name.endswith(".json") or name.endswith(".cf"):
7579
ret |= _format_filename(filepath, line_length, check)

src/cfengine_cli/lint.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,14 @@ def _find_filenames_in_arg_folder(arg: str) -> list[str]:
914914
files = [f for f in files if not f[0] == "."]
915915
# Skip .x.cf files (policy files with intentional errors):
916916
files = [f for f in files if not f.endswith(".x.cf")]
917+
# Skip test-related JSON files during directory traversal:
918+
files = [
919+
f
920+
for f in files
921+
if not f.endswith(
922+
(".input.json", ".jqinput.json", ".x.json", ".expected.json")
923+
)
924+
]
917925
for name in files:
918926
if name.endswith(LINT_EXTENSIONS):
919927
results.append(os.path.join(root, name))

0 commit comments

Comments
 (0)