16
16
import sys
17
17
import token
18
18
import tokenize
19
- from typing import IO , Callable , Iterable , List , Tuple
19
+ from typing import IO , Callable , FrozenSet , Iterable , List , Tuple
20
20
21
- FILE_EXTENSIONS_TO_CHECK : Tuple [str , ...] = (".py" , ".pyx" , ".pxi.ini" , ".pxd" )
22
21
PATHS_TO_IGNORE : Tuple [str , ...] = ("asv_bench/env" ,)
23
22
24
23
@@ -293,6 +292,7 @@ def main(
293
292
function : Callable [[IO [str ]], Iterable [Tuple [int , str ]]],
294
293
source_path : str ,
295
294
output_format : str ,
295
+ file_extensions_to_check : str ,
296
296
) -> bool :
297
297
"""
298
298
Main entry point of the script.
@@ -322,6 +322,10 @@ def main(
322
322
is_failed : bool = False
323
323
file_path : str = ""
324
324
325
+ FILE_EXTENSIONS_TO_CHECK : FrozenSet [str ] = frozenset (
326
+ file_extensions_to_check .split ("," )
327
+ )
328
+
325
329
if os .path .isfile (source_path ):
326
330
file_path = source_path
327
331
with open (file_path , "r" ) as file_obj :
@@ -370,7 +374,7 @@ def main(
370
374
parser .add_argument (
371
375
"--format" ,
372
376
"-f" ,
373
- default = "{source_path}:{line_number}:{msg}. " ,
377
+ default = "{source_path}:{line_number}:{msg}" ,
374
378
help = "Output format of the error message." ,
375
379
)
376
380
parser .add_argument (
@@ -380,6 +384,11 @@ def main(
380
384
required = True ,
381
385
help = "Validation test case to check." ,
382
386
)
387
+ parser .add_argument (
388
+ "--included-file-extensions" ,
389
+ default = "py,pyx,pxd,pxi" ,
390
+ help = "Coma seperated file extensions to check." ,
391
+ )
383
392
384
393
args = parser .parse_args ()
385
394
@@ -388,5 +397,6 @@ def main(
388
397
function = globals ().get (args .validation_type ), # type: ignore
389
398
source_path = args .path ,
390
399
output_format = args .format ,
400
+ file_extensions_to_check = args .included_file_extensions ,
391
401
)
392
402
)
0 commit comments