-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fall back to classifiers if [pypi] license text is really long #8690
Conversation
@@ -50,7 +50,7 @@ function getLicenses(packageData) { | |||
const { | |||
info: { license }, | |||
} = packageData | |||
if (license) { | |||
if (license && license.length < 40) { |
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.
As noted in #8689 (comment) we're going to have to make some kind of assumption here. The longest SPDX identifier in https://raw.githubusercontent.com/jslicense/spdx-license-ids/main/index.json is 36 characters so this seems like a reasonable-ish threshold.
My hunch is that the license meta-data field is more commonly used than the classifiers, so I think switching to prefer the classifiers in all cases is probably going to break more badges out in the wild than doing this.
There isn't really a perfect solution here.
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.
Agreed with the approach. I do think it might be worth adding an inline comment explaining this though so that 40
doesn't appear like a magic number to readers of the code.
I recognize that one could use git blame info to backtrack to this PR and explanation, but I'm a fan of having things be as self-explanatory as possible within the code
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.
👍
Closes #8689