@@ -113,22 +113,26 @@ def gather_statistics(line_counts, checkers, file_to_expectations_map, dir_path,
113113 expected_checkers = file_to_expectations_map .get (file_key )
114114 if expected_checkers :
115115 line_counts ['unsafe' ] += number_of_lines
116+ line_counts ['unsafeFiles' ] += 1
116117 else :
117118 line_counts ['safe' ] += number_of_lines
119+ line_counts ['safeFiles' ] += 1
118120 for checker in checkers :
119121 per_checker_counts = line_counts ['checkers' ][checker .name ()]
120122 if expected_checkers and checker .name () in expected_checkers :
121123 per_checker_counts ['unsafe' ] += number_of_lines
124+ per_checker_counts ['unsafeFiles' ] += 1
122125 else :
123126 per_checker_counts ['safe' ] += number_of_lines
127+ per_checker_counts ['safeFiles' ] += 1
124128
125129
126130def safe_ratio (line_counts ):
127131 return line_counts ['safe' ] / (line_counts ['safe' ] + line_counts ['unsafe' ])
128132
129133
130134def print_percentage (label , line_counts ):
131- return print ('{}: {:.2f}% safe' .format (label , safe_ratio (line_counts ) * 100 ))
135+ return print ('{}: {:.2f}% safe ({} safe files / {} unsafe files) ' .format (label , safe_ratio (line_counts ) * 100 , line_counts [ 'safeFiles' ], line_counts [ 'unsafeFiles' ] ))
132136
133137
134138def main ():
@@ -139,9 +143,9 @@ def main():
139143 return
140144
141145 file_to_expectations_map = load_expectations (checkers , args .project )
142- line_counts = {'safe' : 0 , 'unsafe' : 0 , 'checkers' : {}}
146+ line_counts = {'safe' : 0 , 'unsafe' : 0 , 'safeFiles' : 0 , 'unsafeFiles' : 0 , ' checkers' : {}}
143147 for checker in checkers :
144- line_counts ['checkers' ][checker .name ()] = {'safe' : 0 , 'unsafe' : 0 }
148+ line_counts ['checkers' ][checker .name ()] = {'safe' : 0 , 'unsafe' : 0 , 'safeFiles' : 0 , 'unsafeFiles' : 0 }
145149
146150 project = args .project
147151 project_path = Checker .enumerate ()[0 ].project_path (project )
0 commit comments