You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2018/07/12 17:02:30 UTC

[incubator-openwhisk-utilities] branch master updated: Allow file-level exclusions. (#48)

This is an automated email from the ASF dual-hosted git repository.

mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-utilities.git


The following commit(s) were added to refs/heads/master by this push:
     new b5fe944  Allow file-level exclusions. (#48)
b5fe944 is described below

commit b5fe944f99c25ed4c927942ebde3ddd299345d63
Author: rodric rabbah <ro...@gmail.com>
AuthorDate: Thu Jul 12 13:02:28 2018 -0400

    Allow file-level exclusions. (#48)
---
 scancode/scanCode.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

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."""