mrutkows closed pull request #48: Allow file-level exclusions.
URL: https://github.com/apache/incubator-openwhisk-utilities/pull/48
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/scancode/scanCode.py b/scancode/scanCode.py
index 723fc98..30409ca 100755
--- a/scancode/scanCode.py
+++ b/scancode/scanCode.py
@@ -409,17 +409,22 @@ def all_paths(root_dir):
     # For every file in every directory (path) starting at "root_dir"
     for dir_path, dir_names, files in os.walk(root_dir):
         for f in files:
+            filename = os.path.join(dir_path, f)
+
             # Map will contain a boolean for each exclusion path tested
             # as input to the lambda function.
             # only if all() values in the Map are "True" (meaning the file is
             # not excluded) then it should yield the filename to run checks on.
             # not dir_path.endswith(p) and
-            if all(map(lambda p: p not in dir_path,
-                       exclusion_paths)):
-                yield os.path.join(dir_path, f)
+            if all(map(lambda p: p not in dir_path, exclusion_paths)):
+               # directory not excluded, now check for any file exclusions
+               if all(map(lambda p: p not in filename, exclusion_paths)):
+                   yield filename
+               else:
+                   exclusion_files_set.add(filename)
             else:
-                exclusion_files_set.add(os.path.join(dir_path, f))
-
+                # directory is excluded
+                exclusion_files_set.add(filename)
 
 def colors():
     """Create a collection of helper functions to colorize strings."""


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to