Skip to content

Commit 83bc1e3

Browse files
committed
stats_engine: Move counting of all added lines out of inner for loop
1 parent 3f70749 commit 83bc1e3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

stats_engine.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ def collect_stats(kernel_repo, cve_patch):
136136
fp_contents = [line.rstrip('\n') for line in
137137
open(kernel_repo + '/' + file, 'r') if line.strip()]
138138

139+
# we need this array so we can check the above block
140+
all_added = []
141+
for (above, added, below) in patch_added_lines[file]:
142+
# keep track of all added lines
143+
all_added.extend(added)
144+
139145
for i in range(0, len(fp_contents)):
140146
line = fp_contents[i]
141-
# we need this array so we can check the above block
142-
all_added = []
143-
for (above, added, below) in patch_added_lines[file]:
144-
# keep track of all added lines
145-
all_added.extend(added)
146147

147148
for (above, added, below) in patch_added_lines[file]:
148149
# check if the added block is present

0 commit comments

Comments
 (0)