Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #264 from RedHatProductSecurity/components-flaws-s…
Browse files Browse the repository at this point in the history
…orting

Fix affect sorting with no CVE ID attached
  • Loading branch information
JakubFrejlach authored Sep 25, 2023
2 parents ebb18b1 + b8f4a53 commit c1144ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Fixed
* Fix affects sorting with no CVE ID attached in component-flaws output

## [0.3.7] - 2023-09-06
### Added
Expand Down
5 changes: 3 additions & 2 deletions griffon/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,9 @@ def text_output_component_flaws(ctx, output, format, no_wrap=False):
ordered_components = sorted(output["results"], key=lambda d: d["name"])
for item in ordered_components:
component_name = item["name"]
# sorting should work when there is no title or cve-id key
ordered_affects = sorted(item["affects"], key=lambda d: d["flaw_cve_id"])
ordered_affects = sorted(
item["affects"], key=lambda d: (d["flaw_cve_id"] is None, d["flaw_cve_id"])
)
for affect in ordered_affects:
flaw_cve_id = "Vulnerability"
if affect["flaw_cve_id"]:
Expand Down

0 comments on commit c1144ff

Please sign in to comment.