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

False positive for LICENSE file #91

Closed
jessevdp opened this issue Oct 4, 2019 · 6 comments
Closed

False positive for LICENSE file #91

jessevdp opened this issue Oct 4, 2019 · 6 comments

Comments

@jessevdp
Copy link

jessevdp commented Oct 4, 2019

In an effort to remove all linting errors from the awesome-jamstack repository...

Awesome-lint is showing an error regarding the fact that there is no LICENSE for the awesome-jamstack repository. The project already has a license, which is linked to from the README, but this is not detected. In an effort to resolve this issue I've copied their license from its source and added it in a LICENSE file in the root of the repository. And opened a PR: automata/awesome-jamstack#33

Unfortunately, even after deliberately adding the license in a separate file, the build for that repository still fails because the license is not detected. You can check out the build on any commit in that PR, or see here.


How does the linter scan for the LICENSE? And how can I make it detect it? Or is this a bug?

@jessevdp
Copy link
Author

jessevdp commented Oct 4, 2019

The error mentions that "the license is not detected by GitHub. This leads me to believe that MAYBE you scan for the license on the default branch, not the branch of the PR? That would seem odd to me, as a linter should look at the source of the current branch, right?

@nschloe
Copy link

nschloe commented Oct 8, 2019

Bumped into the same thing with https://github.com/nschloe/awesome-scientific-computing.

I now just added a CC0 file, pushed it, and activated awesome-lint for tests in a second PR.

@jessevdp
Copy link
Author

@nschloe—so you confirm it only detects the license after it has been pushed to the default branch?

@nschloe
Copy link

nschloe commented Oct 17, 2019

@jessevdp Yes indeed. Not that there was any doubt about that. I mean, how else is awesome-lint going to do it? First, you'll have to push a license to the default branch, GitHub can then check it, and only then can the linter do anything.

@jessevdp
Copy link
Author

So I took a look at the source to figure out what is happening. The linting error comes from rules/github.js. This rule uses the git CLI to get a URL for the remote origin, parses this URL, retrieves the API endpoint for the repository, and then fetches the repo information from that API endpoint.

From looking at that return value of an API endpoint I concluded that (as @nschloe mentioned) GitHub checks the license on the repository level, not on the branch level. I don't know if there is any way to check this on branch level.

The workaround that @nschloe suggested should work fine. Figuring out how to check the license depending on the branch is probably not worth the effort.

@sindresorhus
Copy link
Owner

Fixed by #123

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

3 participants