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

Fix incorrect transpositions for LGPL and other inputs containing "GPL" or "General Public License" #39

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

lkoskela
Copy link
Contributor

@lkoskela lkoskela commented Mar 6, 2023

This PR fixes a number of incorrect transpositions related to "GPL" or "General Public License".

Firstly, it corrects a mistake in the existing transpositions where LGPL patterns are explicitly mapped to GPL, not LGPL:

-  'GNU LESSER GENERAL PUBLIC LICENSE': 'GPL-3.0-or-later',
+  'GNU LESSER GENERAL PUBLIC LICENSE': 'LGPL',

-  'GNU LGPL v3.0': 'GPL-3.0-or-later',
+  'GNU LGPL v3.0': 'LGPL-3.0-or-later',

Second, it adds additional transpositions to try and match specific version numbers of GPL/LGPL.

Finally, and perhaps most importantly, this PR applies a sort to the transpositions such that we'll try replacing longer substrings before shorter substrings. This is to avoid a common substring such as "GENERAL PUBLIC LICENSE" from matching to "LESSER GENERAL PUBLIC LICENSE" before a more accurate match simply because of the order they were defined in the array.

@kemitchell
Copy link
Member

This looks like good work!

Turns out I didn't have our CI GitHub Action set to run on pull requests, so it wasn't triggered here. I've fixed that on master. Tests pass here on manual run.

@lkoskela can you confirm your work here is licensed under Apache 2.0?

@lkoskela
Copy link
Contributor Author

lkoskela commented Mar 6, 2023

@lkoskela can you confirm your work here is licensed under Apache 2.0?

Confirmed 👍

@kemitchell
Copy link
Member

@lkoskela, thanks for confirming.

Any thoughts on major or minor version bump?

@lkoskela
Copy link
Contributor Author

lkoskela commented Mar 7, 2023

Any thoughts on major or minor version bump?

I’d vote for minor. I can imagine an end user for whom this might seem like a ”breaking” change if their inputs suddenly come out as a different license than before but I would argue that conceptually nothing changes – we’re simply improving accuracy.

@kemitchell kemitchell merged commit d65fac5 into jslicense:master Mar 7, 2023
@kemitchell
Copy link
Member

Published spdx-correct@3.2.0

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.

2 participants