aboutsummaryrefslogtreecommitdiffstats
path: root/anteater/src/patch_scan.py
diff options
context:
space:
mode:
authorlhinds <lhinds@redhat.com>2017-10-10 14:13:55 +0100
committerlhinds <lhinds@redhat.com>2017-10-10 14:20:48 +0100
commit1d191aa05617587f889880bb5344c84a422706e5 (patch)
treea9f9dcdbc0a87186ae01aa2f08e364b1f1458d07 /anteater/src/patch_scan.py
parent3cae5dfd7bbcb64f1ac6fb2263043b251a15ebc0 (diff)
Implements master ignore list
This change introduces a master ignore list, to save having to repeat ignore strings in every project exception file. This is achieved via a new ignore_list.yaml file that is merged with the project exception list and then used for the re.search ignore statement in both patch_scan.py and project_scan.py Change-Id: Ifb60b8ba3091603182c2025dbbbfd1a88a72439b Signed-off-by: lhinds <lhinds@redhat.com>
Diffstat (limited to 'anteater/src/patch_scan.py')
-rw-r--r--anteater/src/patch_scan.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/anteater/src/patch_scan.py b/anteater/src/patch_scan.py
index 3b71f0a..133b0ff 100644
--- a/anteater/src/patch_scan.py
+++ b/anteater/src/patch_scan.py
@@ -47,7 +47,7 @@ def prepare_patchset(project, patchset):
file_audit_list, file_audit_project_list = lists.file_audit_list(project)
# Get file content black list and project waivers
- master_list, project_list_re = lists.file_content_list(project)
+ master_list, ignore_list = lists.file_content_list(project)
# Get File Ignore Lists
file_ignore = lists.file_ignore()
@@ -69,7 +69,7 @@ def prepare_patchset(project, patchset):
# Perform binary and file / content checks
scan_patch(project, patch_file, binary_list,
file_audit_list, file_audit_project_list,
- master_list, project_list_re, licence_ext,
+ master_list, ignore_list, licence_ext,
file_ignore, licence_ignore)
# Process each file in patch set using waivers generated above
@@ -79,7 +79,7 @@ def prepare_patchset(project, patchset):
def scan_patch(project, patch_file, binary_list, file_audit_list,
file_audit_project_list, master_list,
- project_list_re, licence_ext, file_ignore, licence_ignore):
+ ignore_list, licence_ext, file_ignore, licence_ignore):
""" Scan actions for each commited file in patch set """
global failure
if is_binary(patch_file):
@@ -130,7 +130,8 @@ def scan_patch(project, patch_file, binary_list, file_audit_list,
for key, value in master_list.iteritems():
regex = value['regex']
desc = value['desc']
- if re.search(regex, line) and not re.search(project_list_re, line):
+ if re.search(regex, line) and not re.search(
+ ignore_list, line):
logger.error('File contains violation: %s', patch_file)
logger.error('Flagged Content: %s', line.rstrip())
logger.error('Matched Regular Exp: %s', regex)