Skip to content

Commit aa835a2

Browse files
Fixes for issues pointed out by GitHub Code Quality
The fixes were generated by Copilot Autofix, but since it does not support combining multiple into 1 commit / PR I had to do this part manually. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
1 parent b38e94c commit aa835a2

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/cfengine_cli/format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ def _autoformat(
812812
fmt.blank_line()
813813
fmt.macro_indent = indent
814814
elif text(node).startswith("@else"):
815-
indent = fmt.macro_indent
815+
pass
816816
fmt.print(node, 0)
817817
return
818818

src/cfengine_cli/lint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,8 @@ def _lint_json_plain(filename: str) -> int:
12681268
data = f.read()
12691269
r = 0
12701270
try:
1271-
data = json.loads(data)
1272-
except:
1271+
json.loads(data)
1272+
except json.JSONDecodeError:
12731273
r = 1
12741274

12751275
print(_pass_fail_filename(filename, r))

src/cfengine_cli/masterfiles/analyze.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def finalize_vcf(versions_dict, checksums_dict, files_dict):
5252
# sort each version list, descending
5353
working_dict[c][f] = sorted(
5454
working_dict[c][f],
55-
key=lambda v: version_as_comparable_list(v),
55+
key=version_as_comparable_list,
5656
reverse=True,
5757
)
5858
# sort filepaths, alphabetically
@@ -68,7 +68,7 @@ def finalize_vcf(versions_dict, checksums_dict, files_dict):
6868
# sort each version list, descending
6969
working_dict[f][c] = sorted(
7070
working_dict[f][c],
71-
key=lambda v: version_as_comparable_list(v),
71+
key=version_as_comparable_list,
7272
reverse=True,
7373
)
7474
# sort checksums

src/cfengine_cli/masterfiles/check_download_matches_git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def check_download_matches_git(versions):
6868
extraneous_count += len(only_dl)
6969
differing_count += len(value_diff)
7070

71-
nonmatching_versions.sort(key=lambda v: version_as_comparable_list(v), reverse=True)
71+
nonmatching_versions.sort(key=version_as_comparable_list, reverse=True)
7272

7373
# fully sort differences.json:
7474
working_dict = diffs_dict["differences"]

0 commit comments

Comments
 (0)