Skip to content

Don't detect license in other package manifest information (author/dependencies) #4360

Open
@chinyeungli

Description

@chinyeungli

The following 3 sample files have an "extra" unknown_license_reference detected which seems to be noise:
1/
subset of a package.json

  "author": "Selwyn <[email protected]> (https://selwyn.cc/)",
  "license": "ISC",

subset of the license scan result:

      "license_detections": [
        {
          "license_expression": "unknown-license-reference AND isc",
          "license_expression_spdx": "LicenseRef-scancode-unknown-license-reference AND ISC",
          "matches": [
            {
              "license_expression": "unknown-license-reference",
              "license_expression_spdx": "LicenseRef-scancode-unknown-license-reference",
              "from_file": "code/css-declaration-sorter-7.2.0.tgz-extract/package/package.json",
              "start_line": 50,
              "end_line": 51,
              "matcher": "2-aho",
              "score": 60,
              "matched_length": 2,
              "match_coverage": 100,
              "rule_relevance": 60,
              "rule_identifier": "lead-in_unknown_43.RULE",
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/lead-in_unknown_43.RULE",
              "matched_text": "  \"author\": \"Selwyn \[email protected]\u003E (https://selwyn.cc/)\",\n  \"license\": \"ISC\",",
              "matched_text_diagnostics": "cc/)\",\n  \"license\": \""
            },
            {
              "license_expression": "isc",
              "license_expression_spdx": "ISC",
              "from_file": "code/css-declaration-sorter-7.2.0.tgz-extract/package/package.json",
              "start_line": 51,
              "end_line": 51,
              "matcher": "2-aho",
              "score": 100,
              "matched_length": 2,
              "match_coverage": 100,
              "rule_relevance": 100,
              "rule_identifier": "isc_38.RULE",
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/isc_38.RULE",
              "matched_text": "  \"license\": \"ISC\",",
              "matched_text_diagnostics": "license\": \"ISC\","
            }
          ],
          "detection_log": [
            "unknown-match"
          ],
          "identifier": "unknown_license_reference_and_isc-83b73c8e-af2d-adc5-1659-64c84479d7ae"
        }
      ],

2/
subset of the package.json

  "author": "David Bonnet <[email protected]>",
  "license": "MIT",

subset of the license scan result

      "license_detections": [
        {
          "license_expression": "unknown-license-reference AND mit",
          "license_expression_spdx": "LicenseRef-scancode-unknown-license-reference AND MIT",
          "matches": [
            {
              "license_expression": "unknown-license-reference",
              "license_expression_spdx": "LicenseRef-scancode-unknown-license-reference",
              "from_file": "code/astring-1.8.6.tgz-extract/package/package.json",
              "start_line": 47,
              "end_line": 48,
              "matcher": "2-aho",
              "score": 60,
              "matched_length": 2,
              "match_coverage": 100,
              "rule_relevance": 60,
              "rule_identifier": "lead-in_unknown_43.RULE",
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/lead-in_unknown_43.RULE",
              "matched_text": "  \"author\": \"David Bonnet \[email protected]\u003E\",\n  \"license\": \"MIT\",",
              "matched_text_diagnostics": "cc\u003E\",\n  \"license\": \""
            },
            {
              "license_expression": "mit",
              "license_expression_spdx": "MIT",
              "from_file": "code/astring-1.8.6.tgz-extract/package/package.json",
              "start_line": 48,
              "end_line": 48,
              "matcher": "2-aho",
              "score": 100,
              "matched_length": 2,
              "match_coverage": 100,
              "rule_relevance": 100,
              "rule_identifier": "mit_30.RULE",
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE",
              "matched_text": "  \"license\": \"MIT\",",
              "matched_text_diagnostics": "license\": \"MIT\","
            }
          ],
          "detection_log": [
            "unknown-match"
          ],
          "identifier": "unknown_license_reference_and_mit-ec62877c-d215-c922-51a5-b6822ee740cc"
        }
      ],

3/
Not sure if this can be forgivien

          "matches": [
            {
              "license_expression": "unknown-license-reference",
              "license_expression_spdx": "LicenseRef-scancode-unknown-license-reference",
              "from_file": "code/ordered-map-4.4.2.tgz-extract/package/package.json",
              "start_line": 87,
              "end_line": 87,
              "matcher": "2-aho",
              "score": 80,
              "matched_length": 3,
              "match_coverage": 100,
              "rule_relevance": 80,
              "rule_identifier": "unknown-license-reference_334.RULE",
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/unknown-license-reference_334.RULE",
              "matched_text": "    \"rollup-plugin-license\": \"^3.0.0\",",
              "matched_text_diagnostics": "license\": \"^3.0."
            }
          ],

In summary, in the first two cases, SCTK is misled by the author value, while the last case is influenced by the presence of the "license" wording

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions