@@ -407,6 +407,7 @@ def main(
407
407
output_format : str ,
408
408
file_extensions_to_check : str ,
409
409
excluded_file_paths : str ,
410
+ verbose : int ,
410
411
) -> bool :
411
412
"""
412
413
Main entry point of the script.
@@ -423,6 +424,8 @@ def main(
423
424
Comma separated values of what file extensions to check.
424
425
excluded_file_paths : str
425
426
Comma separated values of what file paths to exclude during the check.
427
+ verbose : int
428
+ Verbosity level (currently only distinguishes between zero and nonzero).
426
429
427
430
Returns
428
431
-------
@@ -450,14 +453,22 @@ def main(
450
453
def check_file (file_path : str ):
451
454
nonlocal is_failed
452
455
456
+ local_is_failed = False
457
+ if verbose :
458
+ print ("Checking {}..." .format (file_path ), file = sys .stderr , end = "" )
453
459
with open (file_path , "r" ) as file_obj :
454
460
for line_number , msg in function (file_obj ):
455
- is_failed = True
461
+ local_is_failed = True
456
462
print (
457
463
output_format .format (
458
464
source_path = file_path , line_number = line_number , msg = msg
459
465
)
460
466
)
467
+ if not local_is_failed :
468
+ if verbose :
469
+ print (" OK" , file = sys .stderr )
470
+ else :
471
+ is_failed = True
461
472
462
473
def is_ignored (path : str ):
463
474
path = os .path .abspath (os .path .normpath (path ))
@@ -526,6 +537,12 @@ def is_ignored(path: str):
526
537
default = "asv_bench/env" ,
527
538
help = "Comma separated file paths to exclude." ,
528
539
)
540
+ parser .add_argument (
541
+ "-v" ,
542
+ "--verbose" ,
543
+ action = "count" ,
544
+ help = "Set the verbosity level to the number of times this flag is used." ,
545
+ )
529
546
530
547
args = parser .parse_args ()
531
548
@@ -536,5 +553,6 @@ def is_ignored(path: str):
536
553
output_format = args .format ,
537
554
file_extensions_to_check = args .included_file_extensions ,
538
555
excluded_file_paths = args .excluded_file_paths ,
556
+ verbose = args .verbose ,
539
557
)
540
558
)
0 commit comments