@@ -522,8 +522,6 @@ def __finish_scan_threaded(self, file_map: dict = None) -> bool:
522522 else :
523523 raw_output += ",\n \" %s\" :[%s]" % (file , json .dumps (dep_file , indent = 2 ))
524524 # End for loop
525- else :
526- success = False
527525 raw_output += "\n }"
528526 parsed_json = None
529527 try :
@@ -625,7 +623,6 @@ def scan_files(self, files: []) -> bool:
625623 success = True
626624 if not files :
627625 raise Exception (f"ERROR: Please provide a non-empty list of filenames to scan" )
628- self .print_msg (f'Scanning { len (files )} files...' )
629626 spinner = None
630627 if not self .quiet and self .isatty :
631628 spinner = Spinner ('Fingerprinting ' )
@@ -637,7 +634,23 @@ def scan_files(self, files: []) -> bool:
637634 file_count = 0 # count all files fingerprinted
638635 wfp_file_count = 0 # count number of files in each queue post
639636 scan_started = False
637+ filtered_files = []
638+ # Filter the files to remove anything we shouldn't scan
640639 for file in files :
640+ filename = os .path .basename (file )
641+ filtered_filenames = self .__filter_files ([filename ])
642+ if not filtered_filenames or len (filtered_filenames ) == 0 :
643+ self .print_debug (f'Skipping filtered file: { file } ' )
644+ continue
645+ paths = os .path .dirname (file ).split (os .sep )
646+ if len (self .__filter_dirs (paths )) == len (paths ): # Nothing found to filter
647+ filtered_files .append (file )
648+ else :
649+ self .print_debug (f'Skipping filtered (folder) file: { file } ' )
650+ if len (filtered_files ) > 0 :
651+ self .print_debug (f'Scanning { len (filtered_files )} files...' )
652+ # Process all the requested files
653+ for file in filtered_files :
641654 if self .threaded_scan and self .threaded_scan .stop_scanning ():
642655 self .print_stderr ('Warning: Aborting fingerprinting as the scanning service is not available.' )
643656 break
@@ -697,7 +710,7 @@ def scan_files(self, files: []) -> bool:
697710 if self .threaded_scan :
698711 success = self .__run_scan_threaded (scan_started , file_count )
699712 else :
700- Scanner .print_stderr (f'Warning: No files found to scan from: { files } ' )
713+ Scanner .print_stderr (f'Warning: No files found to scan from: { filtered_files } ' )
701714 return success
702715
703716 def scan_files_with_options (self , files : [], deps_file : str = None , file_map : dict = None ) -> bool :
0 commit comments