Skip to content

Commit

Permalink
add cwe value and value description to presenter
Browse files Browse the repository at this point in the history
  • Loading branch information
multiflexi committed Feb 25, 2024
1 parent 3f0f0fd commit 0f5240d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/presenters/presenters/base_presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ def __init__(self, report_item, report_types, attribute_map):
for attribute_group_item_id, attribute_group_item in attribute_group_items.items():
attr_type = attribute_map[attribute_group_item_id]
attr_key = attr_type.title.lower().replace(" ", "_")

max_occurrence = attr_type.max_occurrence
value_to_add = (
attribute_group_item[0].value
if max_occurrence == 1 and attribute_group_item
else [attribute.value for attribute in attribute_group_item]
)
if attr_key.startswith("cwe"):
value_to_add = {attribute.value: attribute.value_description for attribute in attribute_group_item}
else:
max_occurrence = attr_type.max_occurrence
value_to_add = (
attribute_group_item[0].value
if max_occurrence == 1 and attribute_group_item
else [attribute.value for attribute in attribute_group_item]
)

how_many_with_the_same_name = len(attribute_groups[attr_key])
if how_many_with_the_same_name == 1:
Expand Down

0 comments on commit 0f5240d

Please sign in to comment.