Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set license name instead of ID when using custom license #3915

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

2000rosser
Copy link
Contributor

Description

A valid SPDX is required when using the ID field for licenses. If the license is a custom license, use the name field instead.

Addressed Issue

#3897

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

Signed-off-by: Ross Murphy <RossMurphy@ibm.com>
Copy link

codacy-production bot commented Jul 3, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.02% (target: -1.00%) 66.67% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a4d5a7b) 22074 16811 76.16%
Head commit (177d9b6) 22076 (+2) 16817 (+6) 76.18% (+0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3915) 3 2 66.67%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences


🚀 Don’t miss a bit, follow what’s new on Codacy.

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@2000rosser
Copy link
Contributor Author

I actually don't think the unit test I added is necessary, will remove it.

Signed-off-by: Ross Murphy <RossMurphy@ibm.com>
@nscuro
Copy link
Member

nscuro commented Jul 3, 2024

Thanks @2000rosser!

Do you think you could add a test for this scenario here? https://github.com/DependencyTrack/dependency-track/blob/master/src/test/java/org/dependencytrack/resources/v1/BomResourceTest.java

Have a look at the existing export tests, and either extend them or add a smaller test case that's scoped to only this problem.

We want to ensure that, given a component with custom license, the exported BOM looks like expected (assertThatJson...), and passes schema validation (assertThatNoException().isThrownBy(() -> CycloneDxValidator.getInstance().validate(jsonResponse.getBytes()));).

@2000rosser
Copy link
Contributor Author

@nscuro Sure, I'll take a look and add a test for it

Signed-off-by: Ross Murphy <RossMurphy@ibm.com>
@nscuro nscuro added this to the 4.12 milestone Jul 3, 2024
@nscuro nscuro added the defect Something isn't working label Jul 3, 2024
Copy link
Member

@nscuro nscuro left a comment

Choose a reason for hiding this comment

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

Thanks @2000rosser!

@nscuro nscuro merged commit a9baa82 into DependencyTrack:master Jul 3, 2024
10 of 11 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
defect Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants