Improve declared license collection from nuspec files (#2669) - #5271
Draft
teyesan wants to merge 6 commits into
Draft
Improve declared license collection from nuspec files (#2669)#5271teyesan wants to merge 6 commits into
teyesan wants to merge 6 commits into
Conversation
AyanSinhaMahapatra
left a comment
Member
There was a problem hiding this comment.
@teyesan there are no test files for your tests.
|
|
||
|
|
||
|
|
||
| def test_parse_creates_package_from_nuspec_specflow_mstest_license_file(self): |
Member
There was a problem hiding this comment.
Where are these files that you are testing with?
See test failures: https://dev.azure.com/nexB/scancode-toolkit/_build/results?buildId=19213&view=logs&j=1412dbfa-421a-5a40-8ddf-7073fc46aa19&t=13c90161-2109-5957-f563-a96fefc7d869
Author
|
Two tests are designed to fail currently and will pass once fix has been pushed. |
Signed-off-by: Temi Eyesan <teyesan06@icloud.com>
Signed-off-by: Temi Eyesan <teyesan06@icloud.com>
teyesan
force-pushed
the
improve-declared-license-detection
branch
from
August 19, 2026 20:56
9eba4de to
c9ea9fb
Compare
…ction Signed-off-by: Temi Eyesan <teyesan06@icloud.com>
teyesan
force-pushed
the
improve-declared-license-detection
branch
from
August 21, 2026 02:07
6df7db8 to
bded38b
Compare
…e-org#2669) Signed-off-by: Temi Eyesan <teyesan06@icloud.com>
Signed-off-by: Temi Eyesan <teyesan06@icloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug: The NuGet .nuspec parser mishandled elements that had a type attribute (e.g. LICENSE.txt) xmltodict returns a dict for attributed elements, and the parser was stringifying the whole dict into extracted_license_statement instead of extracting the actual value.
Fix: Parser now branches on type:
type="file" → filename stored in extra_data.license_file, extracted_license_statement left null
type="expression" → SPDX expression extracted directly into extracted_license_statement
Falls back to deprecated licenseUrl only when no element exists
Tests added: 5 nuspec fixtures covering the full decision tree: type="file" (original bug case), type="expression" (same bug, different branch), plain with no attribute, licenseUrl-only fallback, and no license info at all. Also regenerated fizzler.expected.json, a pre-existing integration fixture that had the old buggy output baked in.
Fixes #2669
Tasks
Run tests locally to check for errors.