openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrutkow...@apache.org
Subject [incubator-openwhisk-utilities] branch master updated: If file does not exist, skip it during checks. (#58)
Date Wed, 03 Apr 2019 16:21:19 GMT
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 6ad65eb  If file does not exist, skip it during checks. (#58)
6ad65eb is described below

commit 6ad65eb5b4f68d8c866b035e5679030c5c095ba2
Author: rodric rabbah <rodric@gmail.com>
AuthorDate: Wed Apr 3 12:21:14 2019 -0400

    If file does not exist, skip it during checks. (#58)
---
 scancode/scanCode.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/scancode/scanCode.py b/scancode/scanCode.py
index 06d7dd3..ab1389a 100755
--- a/scancode/scanCode.py
+++ b/scancode/scanCode.py
@@ -86,6 +86,7 @@ MSG_RUNNING_FILE_CHECKS = "    Running File Check [%s]"
 MSG_RUNNING_LINE_CHECKS = "    Running Line Check [%s]"
 MSG_SCANNING_FILTER = "Scanning files with filter: [%s]:"
 MSG_SCANNING_STARTED = "Scanning files starting at [%s]..."
+MSG_SKIPPING_FILE = "SKIPPING non-existent file [%s]"
 
 WARN_CONFIG_SECTION_NOT_FOUND = "Configuration file section [%s] not found."
 WARN_SCAN_EXCLUDED_PATH_SUMMARY = "Scan excluded (%s) patterns:"
@@ -311,6 +312,10 @@ def eol_at_eof(line):
 
 def has_block_license(path):
     """Open file and verify it contains a valid license header."""
+    if not os.path.isfile(path):
+        print_error(MSG_SKIPPING_FILE % file_path)
+        return []
+
     with open(path) as fp:
         for license in valid_licenses:
             # Assure license string is normalized to remove indentations
@@ -393,7 +398,11 @@ def run_file_checks(file_path, checks):
 
 
 def run_line_checks(file_path, checks):
-    """."""
+    """Check each line in a file against given list of filters."""
+    if not os.path.isfile(file_path):
+        print_error(MSG_SKIPPING_FILE % file_path)
+        return []
+
     errors = []
     line_number = 0
     # For each line in the file, run all "line checks"


Mime
View raw message