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

Detect licenses names like MIT-LICENSE.txt #142

Open
silverwind opened this issue Sep 3, 2022 · 4 comments
Open

Detect licenses names like MIT-LICENSE.txt #142

silverwind opened this issue Sep 3, 2022 · 4 comments

Comments

@silverwind
Copy link

silverwind commented Sep 3, 2022

https://github.com/mrjones/oauth has a MIT-LICENSE.txt in its root but it's currently not detected:

E0903 20:40:47.315979   75355 library.go:115] Failed to find license for github.com/mrjones/oauth: cannot find a known open source license for "/go/pkg/mod/github.com/mrjones/[email protected]" whose name matches regexp ^(?i)((UN)?LICEN(S|C)E|COPYING|README|NOTICE).*$ and locates up until "/go/pkg/mod/github.com/mrjones/[email protected]"

Maybe the ^ should be removed from the regex.

@Bobgy
Copy link
Collaborator

Bobgy commented Sep 6, 2022

We may need to split up to multiple regex patterns. For some, it doesn't make sense to remove the ^.

PR welcomed!

@silverwind
Copy link
Author

silverwind commented Sep 6, 2022

FWIW, Github does detect the license correctly on that repo. Maybe their code that does it is open-source, not sure.

Edit: It is https://github.com/licensee/licensee as per this. It uses a scoring system with multiple regexes.

@Bobgy
Copy link
Collaborator

Bobgy commented Sep 7, 2022

Be careful with directly using other open source project's code, there are license issues.

It's good to know someone else also uses multiple patterns.

To add to that, the patterns can have different confidence level. If a file named LICENSE doesn't have a recognized license, we should raise an error. But if a file abcd-licenser.txt doesn't have license content, we can log a debug message instead.

Current behavior: we check for all files matching the regex, but we don't log an error at all for individual files.

@silverwind
Copy link
Author

Asked the author to rename in mrjones/oauth#74.

avelanarius added a commit to avelanarius/quesma that referenced this issue Oct 15, 2024
`github.com/mrjones/oauth` uses a non-standard-named filename for the
`LICENSE` file (`MIT-LICENSE.txt` instead of `LICENSE.txt`).
go-license-detector cannot handle such a case, as seen here:
https://github.com/QuesmaOrg/quesma/actions/runs/11327943230/job/31500069625

The problem was reported to both the go-license library
(google/go-licenses#142) and the oath library
(mrjones/oauth#74), but it's not fixed yet.

Fix the problem by adding an override entry to `overrides.ndjson`.
github-merge-queue bot pushed a commit to QuesmaOrg/quesma that referenced this issue Oct 15, 2024
`github.com/mrjones/oauth` uses a non-standard-named filename for the
`LICENSE.txt` file (`MIT-LICENSE.txt` instead of `LICENSE.txt`).
`go-license-detector` cannot handle such a case, as seen here:
https://github.com/QuesmaOrg/quesma/actions/runs/11327943230/job/31500069625

The problem was already reported to both the `go-licenses` library
(google/go-licenses#142) and the `oauth`
library (mrjones/oauth#74), but it's not fixed
yet.

Fix the problem by adding an override entry to `overrides.ndjson`.
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

No branches or pull requests

2 participants