@ -394,25 +394,23 @@ def print_and_write(file_out, message):
file_out . write ( message + ' \n ' )
def print_errors ( csv_report , bugs_out ) :
with codecs . open ( csv_report , ' r ' , encoding = utils . LOCALE ) as file_in :
reader = utils . locale_csv_reader ( file_in )
reader . next ( ) # first line is header, skip it
def print_errors ( json_report , bugs_out ) :
with codecs . open ( json_report , ' r ' , encoding = utils . LOCALE ) as file_in :
errors = json . load ( file_in )
errors = filter (
lambda row : row [ utils . CSV_INDEX_KIND ] in [ ERROR , WARNING ] ,
reader
)
lambda row : row [ utils . JSON_INDEX_KIND ] in [ ERROR , WARNING ] ,
errors )
with codecs . open ( bugs_out , ' w ' , encoding = utils . LOCALE ) as file_out :
text_errors_list = [ ]
for row in errors :
filename = row [ utils . CSV _INDEX_FILENAME]
filename = row [ utils . JSON _INDEX_FILENAME]
if os . path . isfile ( filename ) :
kind = row [ utils . CSV _INDEX_KIND]
line = row [ utils . CSV _INDEX_LINE]
error_type = row [ utils . CSV _INDEX_TYPE]
msg = row [ utils . CSV _INDEX_QUALIFIER]
kind = row [ utils . JSON _INDEX_KIND]
line = row [ utils . JSON _INDEX_LINE]
error_type = row [ utils . JSON _INDEX_TYPE]
msg = row [ utils . JSON _INDEX_QUALIFIER]
indenter = utils . Indenter ( )
indenter . indent_push ( )
indenter . add (
@ -761,11 +759,11 @@ class Infer:
self . read_proc_stats ( )
self . print_analysis_stats ( )
if report_status == os . EX_OK and not self . args . buck :
csv _report = os . path . join ( self . args . infer_out ,
utils . CSV _REPORT_FILENAME)
json _report = os . path . join ( self . args . infer_out ,
utils . JSON _REPORT_FILENAME)
bugs_out = os . path . join ( self . args . infer_out ,
utils . BUGS_FILENAME )
print_errors ( csv _report, bugs_out )
print_errors ( json _report, bugs_out )
def print_analysis_stats ( self ) :
procs_total = self . stats [ ' int ' ] [ ' procedures ' ]