Merge "Add more_info URL to the YAML output"
This commit is contained in:
commit
deb4773eae
|
@ -60,6 +60,7 @@ This formatter outputs the issues in a yaml format.
|
|||
line_number: 6
|
||||
line_range:
|
||||
- 6
|
||||
more_info: https://docs.openstack.org/bandit/latest/
|
||||
test_id: B506
|
||||
test_name: yaml_load
|
||||
|
||||
|
@ -77,6 +78,8 @@ import sys
|
|||
|
||||
import yaml
|
||||
|
||||
from bandit.core import docs_utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -98,6 +101,8 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1):
|
|||
conf_level=conf_level)
|
||||
|
||||
collector = [r.as_dict() for r in results]
|
||||
for elem in collector:
|
||||
elem['more_info'] = docs_utils.get_url(elem['test_id'])
|
||||
|
||||
itemgetter = operator.itemgetter
|
||||
if manager.agg_type == 'vuln':
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
[bug/1746827] The ``more_info`` URL link displayed in the HTML and JSON
|
||||
outputs is now also available in the YAML output.
|
|
@ -94,3 +94,5 @@ class JsonFormatterTests(testtools.TestCase):
|
|||
data['results'][0]['line_range'])
|
||||
self.assertEqual(self.check_name, data['results'][0]['test_name'])
|
||||
self.assertIn('candidates', data['results'][0])
|
||||
self.assertIn('more_info', data['results'][0])
|
||||
self.assertIsNotNone(data['results'][0]['more_info'])
|
||||
|
|
Loading…
Reference in New Issue