@@ -47,7 +47,8 @@ def extract_warnings_from_compiler_output_json(
47
47
but includes many json objects and may include other output
48
48
that is not json.
49
49
"""
50
- # Regex to find json arrays at the top level of the file in the compiler output
50
+ # Regex to find json arrays at the top level of the file
51
+ # in the compiler output
51
52
json_arrays = re .findall (
52
53
r"\[(?:[^[\]]|\[[^\]]*\])*\]" , compiler_output
53
54
)
@@ -64,7 +65,6 @@ def extract_warnings_from_compiler_output_json(
64
65
for warning in warning_list :
65
66
locations = warning ["locations" ]
66
67
for location in locations :
67
- found_location = False
68
68
for key in ["caret" , "start" , "end" ]:
69
69
if key in location :
70
70
compiler_warnings .append (
@@ -91,7 +91,8 @@ def extract_warnings_from_compiler_output_json(
91
91
92
92
def get_warnings_by_file (warnings : list [dict ]) -> dict [str , list [dict ]]:
93
93
"""
94
- Returns a dictionary where the key is the file and the data is the warnings in that file
94
+ Returns a dictionary where the key is the file and the data is the warnings
95
+ in that file
95
96
"""
96
97
warnings_by_file = defaultdict (list )
97
98
for warning in warnings :
@@ -105,8 +106,9 @@ def get_unexpected_warnings(
105
106
files_with_warnings : dict [str , list [dict ]],
106
107
) -> int :
107
108
"""
108
- Returns failure status if warnings discovered in list of warnings are associated with a file
109
- that is not found in the list of files with expected warnings
109
+ Returns failure status if warnings discovered in list of warnings
110
+ are associated with a file that is not found in the list of files
111
+ with expected warnings
110
112
"""
111
113
unexpected_warnings = []
112
114
for file in files_with_warnings .keys ():
@@ -127,8 +129,8 @@ def get_unexpected_improvements(
127
129
files_with_warnings : dict [str , list [dict ]],
128
130
) -> int :
129
131
"""
130
- Returns failure status if there are no warnings in the list of warnings for a file
131
- that is in the list of files with expected warnings
132
+ Returns failure status if there are no warnings in the list of warnings
133
+ for a file that is in the list of files with expected warnings
132
134
"""
133
135
unexpected_improvements = []
134
136
for file in files_with_expected_warnings :
@@ -171,7 +173,8 @@ def main(argv: list[str] | None = None) -> int:
171
173
"--fail-on-improvement" ,
172
174
action = "store_true" ,
173
175
default = False ,
174
- help = "Flag to fail if files that were expected to have warnings have no warnings" ,
176
+ help = "Flag to fail if files that were expected "
177
+ "to have warnings have no warnings" ,
175
178
)
176
179
parser .add_argument (
177
180
"-t" ,
0 commit comments