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

fall back to classifiers if [pypi] license text is really long #8690

Merged
merged 2 commits into from Dec 10, 2022

Conversation

chris48s
Copy link
Member

@chris48s chris48s commented Dec 7, 2022

Closes #8689

@chris48s chris48s added bug Bugs in badges and the frontend service-badge Accepted and actionable changes, features, and bugs labels Dec 7, 2022
@shields-ci
Copy link

shields-ci commented Dec 7, 2022

Messages
📖 ✨ Thanks for your contribution to Shields, @chris48s!

Generated by 🚫 dangerJS against e9dcf93

@@ -50,7 +50,7 @@ function getLicenses(packageData) {
const {
info: { license },
} = packageData
if (license) {
if (license && license.length < 40) {
Copy link
Member Author

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.

Copy link
Member

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

Copy link
Collaborator

@PaulaBarszcz PaulaBarszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@chris48s chris48s merged commit 4da9e7d into badges:master Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs in badges and the frontend service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PyPI: Very long license badge
5 participants