Skip to content

fix: skip redundant component name override when name already matches#94

Merged
vpetersson merged 1 commit intomasterfrom
tweak-compoonent-name
Jan 7, 2026
Merged

fix: skip redundant component name override when name already matches#94
vpetersson merged 1 commit intomasterfrom
tweak-compoonent-name

Conversation

@vpetersson
Copy link
Contributor

The component name override logic was running in both Step 1 (_apply_sbom_name_override in main.py) and Step 2 (augment_sbom in augmentation.py), causing duplicate log messages like:
'github.com/aquasecurity/trivy' -> 'Trivy' (Step 1)
'Trivy' -> 'Trivy' (Step 2 - redundant)

Now both locations check if existing_name != component_name before applying the override and logging. Also optimized main.py to skip file serialization when no change is needed.

The component name override logic was running in both Step 1
(_apply_sbom_name_override in main.py) and Step 2 (augment_sbom in
augmentation.py), causing duplicate log messages like:
  'github.com/aquasecurity/trivy' -> 'Trivy'  (Step 1)
  'Trivy' -> 'Trivy'                          (Step 2 - redundant)

Now both locations check if existing_name != component_name before
applying the override and logging. Also optimized main.py to skip
file serialization when no change is needed.
Copilot AI review requested due to automatic review settings January 7, 2026 12:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR eliminates redundant component name override operations and log messages that were occurring when the component name already matched the target value. The fix addresses duplicate logging across two steps of the SBOM processing pipeline by adding conditional checks before applying overrides.

Key Changes:

  • Added conditional checks to skip name override when existing name matches target name
  • Optimized file serialization to only occur when actual changes are made
  • Consolidated logging to only output when overrides are actually applied

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sbomify_action/cli/main.py Added conditional checks and needs_update flag to skip redundant CycloneDX and SPDX name overrides and avoid unnecessary file serialization
sbomify_action/augmentation.py Added conditional check to prevent redundant component name overrides in CycloneDX augmentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vpetersson vpetersson merged commit c129090 into master Jan 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant