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.
Description
grayskull > 2.3.0 crashed with an IndexError when license is set to "GPLv3":
I fixed it by just checking if
original_matches
is empty.With only that change, it was guessing "NGPL" for "GPLv3". I modified the
match_license
function to only remove "-only" licenses if an identical "-or-later" license was also in the list.Initial
best_matches
in that case is:[('AGPL-3.0-only', 72.0, 1), ('LGPL-3.0-only', 72.0, 2), ('GPL-3.0-only', 72.0, 3), ('LGPL-3.0-or-later', 72.0, 4), ('NGPL', 66.66666666666667, 0)]
. Not sure whyGPL-3.0-or-later
isn't in the list.This gives us
GPL-3.0-only
which I think is fine.I tried adding a few extra test cases.
"LGPL 2.0" returns "LGPL-2.0-or-later", but "LGPL 3.0" returns "LGPLLR"... (Initial list is:
[('LGPL-3.0-only', 78.75, 0), ('LGPL-3.0-or-later', 78.75, 1), ('GPL-3.0-only', 72.0, 2), ('GPL-3.0-or-later', 72.0, 4), ('LGPLLR', 57.14285714285714, 3)]
, but after the new match, we get[('LGPLLR', 0.5, 2), ('LGPL-3.0-or-later', 0.4117647058823529, 0), ('GPL-3.0-or-later', 0.3125, 1)]
).I didn't find an easy way to fix that. That behavior was the same before my change.