Rework case where no findings are found

This reworks the case were no findings were found to still print the empty
report, and adds an example that triggers this case.
This commit is contained in:
Jamie Finnigan 2014-07-25 11:20:20 -07:00
parent cd7a2df127
commit 3f04370565
2 changed files with 33 additions and 32 deletions

View File

@ -62,14 +62,13 @@ class BanditResultStore():
)
else:
tmpstr += "Run started:\n\t%s\n" % datetime.utcnow()
if self.count > 0:
if is_tty:
tmpstr += "%sFiles tested (%s):%s\n\t" % (
tmpstr += "%sFiles in scope (%s):%s\n\t" % (
utils.color['HEADER'], len(scope),
utils.color['DEFAULT']
)
else:
tmpstr += "Files tested (%s):\n\t" % (len(scope))
tmpstr += "Files in scope (%s):\n\t" % (len(scope))
tmpstr += "%s\n" % "\n\t".join(scope)
@ -91,6 +90,9 @@ class BanditResultStore():
else:
tmpstr += "\nTest results:\n"
if self.count == 0:
tmpstr += "\tNo issues identified.\n"
else:
for filename, issues in self.resstore.items():
for lineno, issue_type, issue_text in issues:
if constants.SEVERITY.index(issue_type) >= level:
@ -120,5 +122,3 @@ class BanditResultStore():
else:
print(tmpstr)
else:
self.logger.error("no results - %s files scanned" % self.count)

1
examples/okay.py Normal file
View File

@ -0,0 +1 @@
print('hopefully no vulnerabilities here')