Skip to content

Commit

Permalink
fix flak8
Browse files Browse the repository at this point in the history
Signed-off-by: Sumit Jaiswal <[email protected]>
  • Loading branch information
justjais committed Jun 21, 2024
1 parent 756727b commit 140ba1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ansible_risk_insight/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def run(self):
temp_file_path = ''
for j in range(1, len(nodes)):
node_rules = nodes[j]['rules']
for k in reversed(range(len(node_rules))): # loop through from rule 11, as that has the mutation
for k in reversed(range(len(node_rules))): # loop through from rule 11, as that has the mutation
w007_rule = node_rules[k]
if (w007_rule['rule']['rule_id']).lower() == 'w007':
if not w007_rule.get('verdict') and w007_rule:
Expand All @@ -259,7 +259,7 @@ def run(self):
temp_file_path = target_file_path
else:
target_file_path = os.path.join(args.target_name, temp_data)
if temp_file_path != '' and target_file_path != temp_file_path:
if temp_file_path != '' and target_file_path != temp_file_path:
update_the_yaml_target(target_file_path, line_number_list, mutated_yaml_list)
line_number_list = []
mutated_yaml_list = []
Expand Down
6 changes: 3 additions & 3 deletions ansible_risk_insight/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,8 @@ def check_diff_and_copy_olddata_to_newdata(line_number_list, lines, new_data):
if line_number_list and isinstance(line_number_list, list):
new_content_last_set = line_number_list[-1]
new_content_last_line = int(new_content_last_set.lstrip("L").split("-")[1])
if new_content_last_line < len(lines)-1:
for i in range(new_content_last_line, len(lines)-1):
if new_content_last_line < len(lines) - 1:
for i in range(new_content_last_line, len(lines) - 1):
new_data.append(lines[i])
return new_data

Expand Down Expand Up @@ -877,7 +877,7 @@ def update_the_yaml_target(file_path, line_number_list, new_content_list):
break
else:
return IndexError("Line number out of range.")
# check for diff b/w new content and old contents,
# check for diff b/w new content and old contents,
# and copy the old content that's not updated by ARI mutation
data_copy = check_diff_and_copy_olddata_to_newdata(line_number_list, lines, data_copy)
# Join the lines back to a single string
Expand Down

0 comments on commit 140ba1b

Please sign in to comment.