Skip to content

Commit

Permalink
Fix custom format argument handling (#380)
Browse files Browse the repository at this point in the history
* Fix incorrect parameter handling
* Remove custom format report limit

Signed-off-by: Antoine Salon <asalon@vmware.com>
  • Loading branch information
evqna authored and ericwb committed Sep 10, 2018
1 parent 2421df6 commit e2594a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions bandit/core/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ def output_results(self, lines, sev_level, conf_level, output_file,
report_func = formatter.plugin
if output_format == 'custom':
report_func(self, fileobj=output_file, sev_level=sev_level,
conf_level=conf_level, lines=lines,
template=template)
conf_level=conf_level, template=template)
else:
report_func(self, fileobj=output_file, sev_level=sev_level,
conf_level=conf_level, lines=lines)
Expand Down
6 changes: 2 additions & 4 deletions bandit/formatters/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ def __missing__(cls, key):


@test_properties.accepts_baseline
def report(manager, fileobj, sev_level, conf_level, lines=-1, template=None):
def report(manager, fileobj, sev_level, conf_level, template=None):
"""Prints issues in custom format
:param manager: the bandit manager object
:param fileobj: The output file object, which may be sys.stdout
:param sev_level: Filtering severity level
:param conf_level: Filtering confidence level
:param lines: Number of lines to report, -1 for all
:param template: Output template with non-terminal tags <N>
(default: '{abspath}:{line}:
{test_id}[bandit]: {severity}: {msg}')
Expand Down Expand Up @@ -149,9 +148,8 @@ def get_similar_tag(tag):

msg_parsed_template = "".join([item for lst in msg_parsed_template_list
for item in lst]) + "\n"
limit = lines if lines > 0 else None
with fileobj:
for defect in results[:limit]:
for defect in results:
evaluated_tags = SafeMapper(
(k, v(defect)) for k, v in tag_mapper.items()
)
Expand Down

0 comments on commit e2594a9

Please sign in to comment.