@@ -296,13 +296,22 @@ def attrib(location, output, template, mapping, inventory, quiet):
296296@click .argument ('location' , nargs = 1 , required = True ,
297297 type = click .Path (exists = True , readable = True , resolve_path = True ))
298298
299+ @click .option ('--show-all' , is_flag = True , default = False ,
300+ help = 'Show all errors and warnings. '
301+ 'By default, running a check only reports these '
302+ 'error levels: CRITICAL, ERROR, and WARNING. '
303+ 'Use this option to report all errors and warning '
304+ 'for any level.'
305+ )
306+
299307@click .help_option ('-h' , '--help' )
300308
301- def check (location ):
309+ def check (location , show_all ):
302310 """
303- Validate .ABOUT file(s) at LOCATION.
311+ Check and validate .ABOUT file(s) at LOCATION for errors and
312+ print error messages on the terminal.
304313
305- LOCATION: Path to a .ABOUT file or a directory tree containing .ABOUT files.
314+ LOCATION: Path to a .ABOUT file or a directory containing .ABOUT files.
306315 """
307316 click .echo ('Running aboutcode-toolkit version ' + __version__ )
308317 click .echo ('Checking ABOUT files...' )
@@ -313,19 +322,22 @@ def check(location):
313322 print_errors = []
314323 for severity , message in errors :
315324 sever = severities [severity ]
316- if sever in problematic_errors :
317- print_errors .append ((msg_format % locals ()))
325+ if show_all :
326+ print_errors .append (msg_format % locals ())
327+ elif sever in problematic_errors :
328+ print_errors .append (msg_format % locals ())
318329
319- number_of_problematic_errors = len (print_errors )
330+ number_of_errors = len (print_errors )
320331
321332 for err in print_errors :
322333 print (err )
323334
324335 if print_errors :
325- click .echo ('Found %(number_of_problematic_errors)d errors' % locals ())
336+ click .echo ('Found {} errors.' .format (number_of_errors ))
337+ # FIXME: not sure this is the right way to exit with a retrun code
326338 sys .exit (1 )
327339 else :
328- click .echo ('No error is found.' )
340+ click .echo ('No error found.' )
329341 # FIXME: return error code?
330342
331343
0 commit comments