""" Creates a directory for scan reports """
try:
os.makedirs(reports_dir)
- logger.info('Creating reports directory: {0}'.format(reports_dir))
+ logger.info('Creating reports directory: %s', reports_dir)
except OSError as e:
if not os.path.isdir(reports_dir):
logger.error(e)
binary_hash = (yl['binaries'][project][file_name])
return binary_hash
except KeyError:
- logger.info('No checksum entries found for {0}'.
- format(file_name))
+ logger.info('No checksum entries found for %s', file_name)
binary_hash = 'null'
return binary_hash
logger.error('Key Error processing file_names list values')
try:
project_list = set((yl['file_audits'][project]['file_names']))
- logger.info('file_names waivers found for {0}'.
- format(project))
+ logger.info('file_names waivers found for %s', project)
except KeyError:
- logger.info('No file_names waivers found for {0}'.
- format(project))
+ logger.info('No file_names waivers found for %s', project)
file_names_re = re.compile("|".join(default_list),
flags=re.IGNORECASE)
try:
project_list = set((yl['file_audits'][project]['file_contents']))
except KeyError:
- logger.info('No file_contents waivers found for {0}'.
- format(project))
+ logger.info('No file_contents waivers found for %s', project)
file_contents_re = re.compile("|".join(default_list),
flags=re.IGNORECASE)
buf = afile.read()
hasher.update(buf)
if hasher.hexdigest() in binary_hash:
- logger.info('Found matching file hash for file: {0}'.
- format(patch_file))
+ logger.info('Found matching file hash for file: %s',
+ patch_file)
else:
- logger.error('Non Whitelisted Binary file: {0}'.
- format(patch_file))
- logger.error('Submit patch with the following hash: {0}'.
- format(hasher.hexdigest()))
+ logger.error('Non Whitelisted Binary file: %s',
+ patch_file)
+ logger.error('Submit patch with the following hash: %s',
+ hasher.hexdigest())
failure = True
with open(reports_dir + "binaries-" + project + ".log", "a") \
as gate_report:
if file_audit_list.search(patch_file) and not \
file_audit_project_list.search(patch_file):
match = file_audit_list.search(patch_file)
- logger.error('Blacklisted file: {0}'.
- format(patch_file))
- logger.error('Matched String: {0}'.
- format(match.group()))
+ logger.error('Blacklisted file: %s', patch_file)
+ logger.error('Matched String: %s', match.group())
failure = True
with open(reports_dir + "file-names_" + project + ".log", "a") \
as gate_report:
if file_content_list.search(line) and not \
file_content_project_list.search(line):
match = file_content_list.search(line)
- logger.error('File contains violation: {0}'.
- format(patch_file))
- logger.error('Flagged Content: {0}'.
- format(line.rstrip()))
- logger.error('Matched String: {0}'.
- format(match.group()))
+ logger.error('File contains violation: %s', patch_file)
+ logger.error('Flagged Content: %s', line.rstrip())
+ logger.error('Matched String: %s', match.group())
failure = True
with open(reports_dir + "contents_" + project + ".log",
"a") as gate_report:
# of a decision made at 2017 plugfest to limit searches to
# just these two strings.
if re.search("copyright", content, re.IGNORECASE):
- logger.info('Contains needed Licence string: {0}'.
- format(patch_file))
+ logger.info('Contains needed Licence string: %s', patch_file)
elif re.search("spdx", content, re.IGNORECASE):
- logger.info('Contains needed Licence string: {0}'.
- format(patch_file))
+ logger.info('Contains needed Licence string: %s', patch_file)
else:
- logger.error('Licence header missing in file: {0}'.
- format(patch_file))
+ logger.error('Licence header missing in file: %s', patch_file)
failure = True
with open(reports_dir + "licence-" + project + ".log", "a") \
as gate_report:
if file_audit_list.search(full_path) and not \
file_audit_project_list.search(full_path):
match = file_audit_list.search(full_path)
- logger.error('Blacklisted filename: {0}'.
- format(full_path))
- logger.error('Matched String: {0}'.
- format(match.group()))
+ logger.error('Blacklisted filename: %s', full_path)
+ logger.error('Matched String: %s', match.group())
with open(reports_dir + "file-names_" + project + ".log",
"a") as gate_report:
gate_report. \
if file_content_list.search(line) and not \
project_content_list.search(line):
match = file_content_list.search(line)
- logger.error('File contains violation: {0}'.
- format(full_path))
- logger.error('Flagged Content: {0}'.
- format(line.rstrip()))
- logger.error('Matched String: {0}'.
- format(match.group()))
+ logger.error('File contains violation: %s', full_path)
+ logger.error('Flagged Content: %s', line.rstrip())
+ logger.error('Matched String: %s', match.group())
with open(reports_dir + "contents-" + project + ".log",
"a") \
as gate_report:
buf = afile.read()
hasher.update(buf)
if hasher.hexdigest() in binary_hash:
- logger.info('Found matching file hash for file: {0}'.
- format(full_path))
+ logger.info('Found matching file hash for file: %s',
+ full_path)
else:
- logger.error('Non Whitelisted Binary file: {0}'.
- format(full_path))
- logger.error('Please submit patch with this hash: {0}'.
- format(hasher.hexdigest()))
+ logger.error('Non Whitelisted Binary file: %s',
+ full_path)
+ logger.error('Please submit patch with this hash: %s',
+ hasher.hexdigest())
with open(reports_dir + "binaries-" + project + ".log",
"a") \
as gate_report:
def licence_root_check(project_dir, project):
if os.path.isfile(project_dir + '/LICENSE'):
- logger.info('LICENSE file present in: {0}'.
- format(project_dir))
+ logger.info('LICENSE file present in: %s', project_dir)
else:
- logger.error('LICENSE file missing in: {0}'.
- format(project_dir))
+ logger.error('LICENSE file missing in: %s', project_dir)
with open(reports_dir + "licence-" + project + ".log",
"a") \
as gate_report:
# of a decision made at 2017 plugfest to limit searches to
# just these two strings.
if re.search("copyright", content, re.IGNORECASE):
- logger.info('Licence string present: {0}'.
- format(full_path))
+ logger.info('Licence string present: %s', full_path)
elif re.search("spdx", content, re.IGNORECASE):
- logger.info('Licence string present: {0}'.
- format(full_path))
+ logger.info('Licence string present: %s', full_path)
else:
- logger.error('Licence header missing: {0}'.
- format(full_path))
+ logger.error('Licence header missing: %s', full_path)
with open(reports_dir + "licence-" + project + ".log",
"a") \
as gate_report: