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()
# 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
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):
hashlist = get_lists.GetLists()
- binary_hash = hashlist.binary_hash(project, patch_file)
+ split_path = patch_file.split(project + '/', 1)[-1]
+ binary_hash = hashlist.binary_hash(project, split_path)
if not binary_list.search(patch_file):
with open(patch_file, 'rb') as afile:
buf = afile.read()
as gate_report:
gate_report.write('Non Whitelisted Binary file: {0}\n'.
format(patch_file))
+ gate_report.write('Submit patch with the following hash: {0}\n'.
+ format(hasher.hexdigest()))
+
else:
# Check file names / extensions
if file_audit_list.search(patch_file) and not \
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)