licensee / licensee

A Ruby Gem to detect under what license a project is distributed.

Home Page:https://licensee.github.io/licensee/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MIT license not detected on z-schema NPM package

villelahdenvuo opened this issue · comments

Describe the bug

MIT license not detected on z-schema NPM package

It has a LICENSE file and package.json license property "MIT", so it should be detected.

Steps to reproduce the behavior

  1. Try to detect license of https://github.com/zaggino/z-schema
  2. License is detected as "other"

Expected behavior

License should be detected as MIT.

Additional information

See github/licensed#453

The LICENSE file falls below the threshold for positive identification as MIT due to the URL below. If you join with the previous line the URL will be ignored -- licensee expects arbitrary text on the (c) line.

% bundle exec licensee diff --license=MIT https://github.com/zaggino/z-schema
Comparing to MIT License:
Input Length:      1076
License length:    1020
Similarity:      92.54%
diff --git a/LICENSE b/LICENSE
index 49b0d1f..922b6b2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,14 +1,14 @@
{+https://github.com/zaggino/z-schema/graphs/contributors+} permission is hereby
granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the 'software'), to deal in the software without
restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the software, and
to permit persons to whom the software is furnished to do so, subject to the
following conditions: the above copyright notice and this permission notice
shall be included in all copies or substantial portions of the software. the
software is provided 'as is', without warranty of any kind, express or implied,
including but not limited to the warranties of merchantability, fitness for a
particular purpose and noninfringement. in no event shall the authors or
copyright holders be liable for any claim, damages or other liability, whether
in an action of contract, tort or otherwise, arising from, out of or in
connection with the software or the use or other dealings in the software.

@mlinksva Shouldn't it still work with the detect_packages option? I tested the regex with the package.json contents and it matched the MIT license.

Edit: It seems like this option is not working, as I've seen many packages not detected even though they have the license field in the package.json.

It does detect MIT in packages.json, but given multiple sources, it needs them to agree for MIT to be the overall conclusion, and it isn't confident enough in the LICENSE source:

% bundle exec licensee detect --packages --license=MIT https://github.com/zaggino/z-schema
License:        NOASSERTION
Matched files:  LICENSE, package.json
LICENSE:
  Content hash:  04688102e890f435052872faa888443cfd0cacca
  License:       NOASSERTION
  Closest non-matching licenses:
    MIT similarity:    92.54%
    MIT-0 similarity:  71.49%
    NCSA similarity:   59.66%
package.json:
  Confidence:  90.00%
  Matcher:     Licensee::Matchers::NpmBower
  License:     MIT
Comparing to MIT License:
Input Length:      1076
License length:    1020
Similarity:      92.54%
diff --git a/LICENSE b/LICENSE
index 49b0d1f..922b6b2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,14 +1,14 @@
{+https://github.com/zaggino/z-schema/graphs/contributors+} permission is hereby
granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the 'software'), to deal in the software without
restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the software, and
to permit persons to whom the software is furnished to do so, subject to the
following conditions: the above copyright notice and this permission notice
shall be included in all copies or substantial portions of the software. the
software is provided 'as is', without warranty of any kind, express or implied,
including but not limited to the warranties of merchantability, fitness for a
particular purpose and noninfringement. in no event shall the authors or
copyright holders be liable for any claim, damages or other liability, whether
in an action of contract, tort or otherwise, arising from, out of or in
connection with the software or the use or other dealings in the software.

@mlinksva Thank you very much for the explanation! Is the package.json confidence hard coded to 90%? If so I can make a PR to update the docs about that, so that people can see how to enable that.

Edit: I just found the code and it is indeed 90% for package matchers. I will make PR to update the docs.

Yes 90% is hard coded, I think on the idea that a license ID alone should give one less confidence than a license text (in part because most licenses actually require keeping the text).