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

License not detected, because of README with references to other licenses #392

Closed
gdsotirov opened this issue Jul 28, 2019 · 6 comments
Closed

Comments

@gdsotirov
Copy link

I have a project almost ready for import in GitHub after migration from a legacy VCS. However, when I run licensee locally in the migrated Git repository I'm getting the following results:

License:        NOASSERTION
Matched files:  COPYING, README
COPYING:
  Content hash:  3becd209e8ed8039656c1debe01dd17b9a79208f
  Confidence:    100.00%
  Matcher:       Licensee::Matchers::Exact
  License:       GPL-2.0
README:
  Content hash:  36153308258b48be362f3413cd7119f05c07a582
  Confidence:    90.00%
  Matcher:       Licensee::Matchers::Reference
  License:       MIT

File COPYING is exact match for GPL2 as expected, but the text in README is causing detection of MIT license reference and hence no license detection for the project. The README file contains the following section:

License
------------------------------------------------------------------------------
The entire software including the packages are licensed under the
General Public License (GPL). See file COPYING for details.
Please, note that some of the software bundled in the packages can be with
different than GPL license (MPL, MIT, Skype, Opera, etc).

I tried removing the "references" leaving just the line "See file COPYING for details." in this section, but like this the result from licensee becomes:

License:        NOASSERTION
Matched files:  COPYING, README
COPYING:
  Content hash:  3becd209e8ed8039656c1debe01dd17b9a79208f
  Confidence:    100.00%
  Matcher:       Licensee::Matchers::Exact
  License:       GPL-2.0
README:
  Content hash:  672971383d3e5255c587f2a00b652a9cba3ed3fd
  License:       NOASSERTION

So the project's license is still not properly detected? How to fix this?

@mlinksva
Copy link
Contributor

mlinksva commented Jul 28, 2019

Licensee running on github.com doesn't look at READMEs so your project should be properly detected as GPL-2.0 when you push it to github.com.

However, it looks like you've found a bug in some combination of https://github.com/licensee/licensee/blob/master/lib/licensee/matchers/reference.rb and https://github.com/licensee/licensee/blob/master/lib/licensee/project_files/readme_file.rb

I suspect MIT is being detected in the README because that word corresponds to a license name or identifier. One partial fix might be to just make the confidence reported by the reference matcher way lower.

As to why you see NOASSERTION when MIT is removed from the README, it's because there is still a license heading, which triggers the looking at the README, and of course no license identifier is found.

GitHub
A Ruby Gem to detect under what license a project is distributed. - licensee/licensee
GitHub
A Ruby Gem to detect under what license a project is distributed. - licensee/licensee

@gdsotirov
Copy link
Author

Licensee running on github.com doesn't look at READMEs so your project should be properly detected as GPL-2.0 when you push it to github.com.

Is there a setting for excluding READMEs, so I could test locally?

One partial fix might be to just make the confidence reported by the reference matcher way lower.

You mean fix it in licensee's sources?

As to why you see NOASSERTION when MIT is removed from the README, it's because there is still a license heading, which triggers the looking at the README, and of course no license identifier is found.

Thanks for explaining. Can I do something about this? Can I exclude the README detection for this particular project?

@mlinksva
Copy link
Contributor

mlinksva commented Jul 28, 2019

--no-readme, see https://github.com/licensee/licensee/blob/master/docs/command-line-usage.md#detecting-a-projects-license

Yes, by fix I mean in licensee's sources -- in one of the files I link to above, plus possibly some corresponding test file(s).

GitHub
A Ruby Gem to detect under what license a project is distributed. - licensee/licensee

@gdsotirov
Copy link
Author

gdsotirov commented Jul 29, 2019

Hmm, I seem to be using the latest released version (9.11.0), but this option isn't advertised in help output:

$ licensee help
Licensee commands:
  licensee detect [PATH]        # Detect the license of the given project
  licensee diff [PATH]          # Compare the given license text to a known license
  licensee help [COMMAND]       # Describe available commands or one specific command
  licensee license-path [PATH]  # Returns the path to the given project's license file
  licensee version              # Return the Licensee version

Options:
  [--remote], [--no-remote]  # Assume PATH is a GitHub owner/repo path

Perhaps it's good to fix this too. Otherwise, the option works and license is properly detected without considering the README file.

@mlinksva
Copy link
Contributor

licensee help detect does show the readme options. I wonder if the command line help bug here isn't that remote docs are baked into bin/licensee instead of appearing context sensitive like other options. I might be missing something though.

@stale
Copy link

stale bot commented Sep 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 28, 2019
@stale stale bot closed this as completed Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants