@@ -336,27 +336,26 @@ def main():
336336 if not args .miss :
337337 print ("\n Bad words\n " )
338338
339- prev = ""
340- bc = 0
341- for x in bad_words :
342- if (x [0 ] != prev ):
343- print ("\n " , x [0 ],":" , sep = '' )
344- if (x [0 ] == prev ) and args .first :
339+ previous_word = ""
340+
341+ for misspelled_word , found_file , line_num in bad_words :
342+
343+ if (misspelled_word != previous_word ):
344+ print ("\n " , misspelled_word ,":" , sep = '' )
345+
346+ if (misspelled_word == previous_word ) and args .first :
345347 sys .stderr .write ('.' )
346348 continue
349+
347350 if args .vim :
348- print (" vim +" , x [ 2 ] , " " , x [ 1 ] , sep = '' , file = sys .stderr )
351+ print (" vim +" , line_num , " " , found_file , sep = '' , file = sys .stderr )
349352 else :
350- print (" " , x [1 ], ", " , x [2 ], sep = '' , file = sys .stderr )
351- prev = x [0 ]
352- bc = bc + 1
353+ print (" " , found_file , ", " , line_num , sep = '' , file = sys .stderr )
353354
354- if not args .miss :
355- print ("" )
355+ previous_word = misspelled_word
356356
357357 print ("" )
358- print (bc , "unknown words found" )
359- print (len (bad_words ), "instances" )
358+ print (len (bad_words ), "misspellings found" )
360359
361360 sys .exit (len (bad_words ))
362361
0 commit comments