Skip to content

Commit

Permalink
Performance fix (#502)
Browse files Browse the repository at this point in the history
* Fix #490 -- Fix performance issue introduced in 1.6.0

The lines were introduced in 7c4b9fa
and have two effects. First they cause `get_issue_list` to run twice and before
the user receives feedback that bandit started running. Secondly it does not
display any output if no issues are found, which is an unintended behavior change.

* add namespaces for parent attributes

* pylint formatting changes

* made bandit_parent a private attr

* temporary fix; perf issue only on quiet

* update perf issue
  • Loading branch information
tylerwince authored and ericwb committed Jun 22, 2019
1 parent 047e6bf commit d25f3fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions bandit/formatters/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1):
"""

bits = []
issues = manager.get_issue_list(sev_level, conf_level)
if len(issues) or not manager.quiet:
if not manager.quiet or manager.results_count(sev_level, conf_level):
bits.append(header("Run started:%s", datetime.datetime.utcnow()))

if manager.verbose:
Expand Down
3 changes: 1 addition & 2 deletions bandit/formatters/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1):
"""

bits = []
issues = manager.get_issue_list(sev_level, conf_level)

if len(issues) or not manager.quiet:
if not manager.quiet or manager.results_count(sev_level, conf_level):
bits.append("Run started:%s" % datetime.datetime.utcnow())

if manager.verbose:
Expand Down

0 comments on commit d25f3fc

Please sign in to comment.