-
Notifications
You must be signed in to change notification settings - Fork 37
fix: evaluate full SPDX license expressions #98
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
Open
mimran-khan
wants to merge
7
commits into
NVIDIA:main
Choose a base branch
from
mimran-khan:fix/spdx-or-expression-truncated
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d2f1319
fix: evaluate full SPDX license expressions
mimran-khan b55d233
Merge origin/main into fix/spdx-or-expression-truncated
mimran-khan 0f263c2
fix: strip comment closers from SPDX license expressions
mimran-khan c7f9610
merge main into fix/spdx-or-expression-truncated
mimran-khan 94a9c8c
fix: truncate SPDX capture at inline comment terminators
mimran-khan 11b7f48
merge main into fix/spdx-or-expression-truncated
mimran-khan 2954bf9
merge main into fix/spdx-or-expression-truncated
mimran-khan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Stop the capture before comment terminators
Capturing the entire line leaves closing comment syntax attached to the final SPDX symbol. For example,
/* SPDX-License-Identifier: MIT OR GPL-3.0 */in a scanned.jsfile becomesMIT OR GPL-3.0 */;GPL-3.0 */is treated as unknown, and default (non-strict) validation passes with only a warning. HTML-comment headers have the same problem. Please parse a valid SPDX expression without*//-->(ideally with the existing SPDX expression parser) so the blocked component cannot be hidden.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep,
/* SPDX-License-Identifier: MIT OR GPL-3.0 */was capturingGPL-3.0 */as the last symbol, so default mode only warned.I strip
*/and-->after the capture, then evaluate the expression as before. Added JS block-comment and HTML-comment cases; both fail closed on GPL-3.0.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the block-comment and HTML cases. This still strips the terminator only when it is at the end of the line. With an inline block comment containing SPDX-License-Identifier: MIT OR GPL-3.0 followed by code on the same line, the GPL identifier retains the terminator and code suffix, so default validation passes with only an unknown-license warning. Please stop the capture at the first comment terminator wherever it occurs and add an inline-code regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch on inline block comments. _strip_spdx_capture now truncates at the first */ or --> anywhere in the captured span, not only at end-of-line. Added a regression with trailing code on the same line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline */ truncation is in _strip_spdx_capture now, with a same-line code suffix regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged main and pushed another fix here. _strip_spdx_capture now truncates at the first */ or --> anywhere in the captured span, not only at end-of-line. Added a regression for inline block comments that share a line with trailing source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replying on your inline thread: inline */ truncation is in _strip_spdx_capture now, with a same-line code suffix regression. Merged main as well (2954bf9).