-
Notifications
You must be signed in to change notification settings - Fork 64
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
🪪 Improvements to spdx license validation #1634
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'myst-frontmatter': patch | ||
--- | ||
|
||
Improvements to spdx license validation |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,6 +280,53 @@ cases: | |
content: | ||
url: https://example.com | ||
warnings: 1 | ||
- title: url string coerces to license from spdx list | ||
raw: | ||
license: https://creativecommons.org/licenses/by/4.0/ | ||
normalized: | ||
license: | ||
content: | ||
id: CC-BY-4.0 | ||
name: Creative Commons Attribution 4.0 International | ||
url: https://creativecommons.org/licenses/by/4.0/ | ||
CC: true | ||
free: true | ||
- title: url coerces to license from spdx list | ||
raw: | ||
license: | ||
url: https://creativecommons.org/licenses/by/4.0/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, this would fail - i.e. if the url was explicitly provided as Now, this coerces correctly to SPDX. |
||
normalized: | ||
license: | ||
content: | ||
id: CC-BY-4.0 | ||
name: Creative Commons Attribution 4.0 International | ||
url: https://creativecommons.org/licenses/by/4.0/ | ||
CC: true | ||
free: true | ||
- title: url coerces to license from spdx list with http | ||
raw: | ||
license: | ||
url: http://creativecommons.org/licenses/by/4.0/ | ||
normalized: | ||
license: | ||
content: | ||
id: CC-BY-4.0 | ||
name: Creative Commons Attribution 4.0 International | ||
url: https://creativecommons.org/licenses/by/4.0/ | ||
CC: true | ||
free: true | ||
- title: url coerces to license from spdx list without trailing slash | ||
raw: | ||
license: | ||
url: https://creativecommons.org/licenses/by/4.0 | ||
normalized: | ||
license: | ||
content: | ||
id: CC-BY-4.0 | ||
name: Creative Commons Attribution 4.0 International | ||
url: https://creativecommons.org/licenses/by/4.0/ | ||
CC: true | ||
free: true | ||
- title: string with no spaces coerces to unknown id (and warns) | ||
raw: | ||
license: my-custom-license | ||
|
@@ -288,7 +335,7 @@ cases: | |
content: | ||
id: my-custom-license | ||
warnings: 1 | ||
- title: Other short string coerces to note (and warns) | ||
- title: Other long string coerces to note (and warns) | ||
raw: | ||
license: | | ||
my custom license but this is really long, like, more than one hundred characters long. | ||
|
@@ -300,11 +347,21 @@ cases: | |
my custom license but this is really long, like, more than one hundred characters long. | ||
clearly if it is this long it cannot be a name but must be a note. | ||
warnings: 1 | ||
- title: Other long string coerces to name (and warns) | ||
- title: Other short string coerces to name (and warns) | ||
raw: | ||
license: my custom license | ||
normalized: | ||
license: | ||
content: | ||
name: my custom license | ||
warnings: 1 | ||
- title: Long string with "mit" buried in it is not coerced to MIT license | ||
raw: | ||
license: | | ||
This is an open access article. Unrestricted non-commercial use is permitted provided the original work is properly cited | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The utility MyST uses to match license IDs with SPDX is way too generous. It would pick up on the |
||
normalized: | ||
license: | ||
content: | ||
note: | | ||
This is an open access article. Unrestricted non-commercial use is permitted provided the original work is properly cited | ||
warnings: 1 |
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.
Previously (and currently), this test case is passing - i.e. setting
license
to a known SPDX url would validate to the correct SPDX license object.