Fix Expat license notice detection - #5340
Open
nikitaijari wants to merge 1 commit into
Open
nikitaijari wants to merge 1 commit into
nikitaijari wants to merge 1 commit into
Conversation
Signed-off-by: Nikita Ijari <104191707+nikitaijari@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4971
Summary
The Expat license notice in the
pep8-namingLICENSE file is detected as bothmitandunknown-license-reference.The problematic notice is:
Licensed under the terms of the Expat LicenseThe 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.RULEmatches the generic introductionLicensed under the terms ofbut 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 inreference_matches. Therefore, changing only the final license-expression calculation would not remove the reportedunknown-license-reference.Changes
mit_expat.RULEto specifically recognize:Licensed under the terms of the Expat LicenseCHANGELOG.rstAUTHORS.rstWith the new rule, the Expat notice is recognized as
mitinstead of being reported through the genericunknown-license-referencerule.Testing
Targeted regression test:
Licensedcode test suite:
The two failures are unrelated to this change:
test_match_has_correct_line_positions_in_automake_perl_filetest_dump_license- failed to loadw3c-docs-19990405from the local Windows AppData license data.Full test suite:
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
CHANGELOG.rst