Skip to content

Fix Expat license notice detection - #5340

Open
nikitaijari wants to merge 1 commit into
aboutcode-org:developfrom
nikitaijari:fix-expat-license-reference
Open

nikitaijari wants to merge 1 commit into
aboutcode-org:developfrom
nikitaijari:fix-expat-license-reference

Conversation

@nikitaijari

Copy link
Copy Markdown

Fixes #4971

Summary

The Expat license notice in the pep8-naming LICENSE file is detected as both mit and unknown-license-reference.
The problematic notice is:
Licensed under the terms of the Expat License

The issue was originally reported with ScanCode 32.5.0 installed through pip on Linux. I reproduced the reported behavior using ScanCode 32.5.0 in Windows.

Investigation

The root cause is that license-intro_20.RULE matches the generic introduction Licensed under the terms of but does not identify the Expat license itself. I also looked at how these matches are handled during license detection. License-introduction matches can be filtered when calculating the final detected license expression but the original match can still be reported in reference_matches. Therefore, changing only the final license-expression calculation would not remove the reported unknown-license-reference.

Changes

  • Added mit_expat.RULE to specifically recognize:
    Licensed under the terms of the Expat License
  • Added a regression test using the Expat license notice and the corresponding expected output
  • Updated CHANGELOG.rst
  • Added myself to AUTHORS.rst

With the new rule, the Expat notice is recognized as mit instead of being reported through the generic unknown-license-reference rule.

Testing

Targeted regression test:

pytest -q tests/licensedcode/test_plugin_license_detection.py -k "unknown_license_intro_expat"

1 passed, 20 deselected

Licensedcode test suite:

pytest -q tests/licensedcode

474 passed, 2 failed

The two failures are unrelated to this change:

  • test_match_has_correct_line_positions_in_automake_perl_file
  • test_dump_license - failed to load w3c-docs-19990405 from the local Windows AppData license data.

Full test suite:

pytest

3838 passed, 91 failed, 42 skipped, 4 xfailed

The full-suite failures occurred in unrelated areas of the test suite. The targeted regression test passes.

Note: I'm new to open-source contribution so please give me feedback if there is a better way to approach this, structure the regression test or handle any part of the contribution process.

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled and links the original issue
  • Tests pass - full local test suite has unrelated failures; CI checks are pending
  • Commit is in a uniquely-named feature branch with no merge conflicts
  • Updated documentation pages (not applicable)
  • Updated CHANGELOG.rst

Signed-off-by: Nikita Ijari <104191707+nikitaijari@users.noreply.github.com>

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Expat reference reported as unknown license reference

1 participant