-
-
Notifications
You must be signed in to change notification settings - Fork 792
Follow license reference to another file #2616
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5fa4d00
Create plugin for following reference files
akugarg 5e4928d
Add new test cases
akugarg 4aab0aa
Update test cases upto expectations
akugarg 6f751e9
Merge branch 'nexB:develop' into follow_reference
akugarg a84b1ed
define process_codebase function for matching references
akugarg 466e375
Add unit tests
akugarg 6aa5d9d
Fix minor typo in comment
pombredanne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
165 changes: 165 additions & 0 deletions
165
tests/licensedcode/data/plugin_license/license_reference/scan-ref.expected.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| { | ||
| "headers": [ | ||
| { | ||
| "tool_name": "scancode-toolkit", | ||
| "options": { | ||
| "input": "<path>", | ||
| "--json": "<file>", | ||
| "--license": true, | ||
| "--license-text": true, | ||
| "--license-text-diagnostics": true, | ||
| "--strip-root": true | ||
| }, | ||
| "notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", | ||
| "message": null, | ||
| "errors": [], | ||
| "extra_data": { | ||
| "files_count": 2 | ||
| } | ||
| } | ||
| ], | ||
| "files": [ | ||
| { | ||
| "path": "LICENSE", | ||
| "type": "file", | ||
| "licenses": [ | ||
| { | ||
| "key": "mit", | ||
| "score": 100.0, | ||
| "name": "MIT License", | ||
| "short_name": "MIT License", | ||
| "category": "Permissive", | ||
| "is_exception": false, | ||
| "is_unknown": false, | ||
| "owner": "MIT", | ||
| "homepage_url": "http://opensource.org/licenses/mit-license.php", | ||
| "text_url": "http://opensource.org/licenses/mit-license.php", | ||
| "reference_url": "https://scancode-licensedb.aboutcode.org/mit", | ||
| "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE", | ||
| "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml", | ||
| "spdx_license_key": "MIT", | ||
| "spdx_url": "https://spdx.org/licenses/MIT", | ||
| "start_line": 1, | ||
| "end_line": 1, | ||
| "matched_rule": { | ||
| "identifier": "mit_66.RULE", | ||
| "license_expression": "mit", | ||
| "licenses": [ | ||
| "mit" | ||
| ], | ||
| "referenced_filenames": [], | ||
| "is_license_text": false, | ||
| "is_license_notice": true, | ||
| "is_license_reference": false, | ||
| "is_license_tag": false, | ||
| "is_license_intro": false, | ||
| "has_unknown": false, | ||
| "matcher": "1-hash", | ||
| "rule_length": 10, | ||
| "matched_length": 10, | ||
| "match_coverage": 100.0, | ||
| "rule_relevance": 100 | ||
| }, | ||
| "matched_text": "that is licensed under [MIT](http://opensource.org/licenses/MIT)." | ||
| } | ||
| ], | ||
| "license_expressions": [ | ||
| "mit" | ||
| ], | ||
| "percentage_of_license_text": 100.0, | ||
| "scan_errors": [] | ||
| }, | ||
| { | ||
| "path": "license-notice.txt", | ||
| "type": "file", | ||
| "licenses": [ | ||
| { | ||
| "key": "unknown-license-reference", | ||
| "score": 27.0, | ||
| "name": "Unknown License file reference", | ||
| "short_name": "Unknown License reference", | ||
| "category": "Unstated License", | ||
| "is_exception": false, | ||
| "is_unknown": true, | ||
| "owner": "Unspecified", | ||
| "homepage_url": null, | ||
| "text_url": "", | ||
| "reference_url": "https://scancode-licensedb.aboutcode.org/unknown-license-reference", | ||
| "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE", | ||
| "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.yml", | ||
| "spdx_license_key": "LicenseRef-scancode-unknown-license-reference", | ||
| "spdx_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE", | ||
| "start_line": 34, | ||
| "end_line": 34, | ||
| "matched_rule": { | ||
| "identifier": "unknown-license-reference_25.RULE", | ||
| "license_expression": "unknown-license-reference", | ||
| "licenses": [ | ||
| "unknown-license-reference" | ||
| ], | ||
| "referenced_filenames": [ | ||
| "LICENSE" | ||
| ], | ||
| "is_license_text": false, | ||
| "is_license_notice": false, | ||
| "is_license_reference": false, | ||
| "is_license_tag": true, | ||
| "is_license_intro": false, | ||
| "has_unknown": true, | ||
| "matcher": "2-aho", | ||
| "rule_length": 5, | ||
| "matched_length": 5, | ||
| "match_coverage": 100.0, | ||
| "rule_relevance": 27 | ||
| }, | ||
| "matched_text": "license\": \"SEE LICENSE IN LICENSE." | ||
| }, | ||
| { | ||
| "key": "mit", | ||
| "score": 100.0, | ||
| "name": "MIT License", | ||
| "short_name": "MIT License", | ||
| "category": "Permissive", | ||
| "is_exception": false, | ||
| "is_unknown": false, | ||
| "owner": "MIT", | ||
| "homepage_url": "http://opensource.org/licenses/mit-license.php", | ||
| "text_url": "http://opensource.org/licenses/mit-license.php", | ||
| "reference_url": "https://scancode-licensedb.aboutcode.org/mit", | ||
| "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE", | ||
| "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml", | ||
| "spdx_license_key": "MIT", | ||
| "spdx_url": "https://spdx.org/licenses/MIT", | ||
| "start_line": 1, | ||
| "end_line": 1, | ||
| "matched_rule": { | ||
| "identifier": "mit_66.RULE", | ||
| "license_expression": "mit", | ||
| "licenses": [ | ||
| "mit" | ||
| ], | ||
| "referenced_filenames": [], | ||
| "is_license_text": false, | ||
| "is_license_notice": true, | ||
| "is_license_reference": false, | ||
| "is_license_tag": false, | ||
| "is_license_intro": false, | ||
| "has_unknown": false, | ||
| "matcher": "1-hash", | ||
| "rule_length": 10, | ||
| "matched_length": 10, | ||
| "match_coverage": 100.0, | ||
| "rule_relevance": 100 | ||
| }, | ||
| "matched_text": "that is licensed under [MIT](http://opensource.org/licenses/MIT)." | ||
| } | ||
| ], | ||
| "license_expressions": [ | ||
| "unknown-license-reference", | ||
| "mit" | ||
| ], | ||
| "percentage_of_license_text": 0.2, | ||
| "scan_errors": [] | ||
| } | ||
| ] | ||
| } |
75 changes: 75 additions & 0 deletions
75
tests/licensedcode/data/plugin_license/license_reference/scan-wref.expected.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| "headers": [ | ||
| { | ||
| "tool_name": "scancode-toolkit", | ||
| "options": { | ||
| "input": "<path>", | ||
| "--json": "<file>", | ||
| "--license": true, | ||
| "--license-text": true, | ||
| "--license-text-diagnostics": true, | ||
| "--strip-root": true | ||
| }, | ||
| "notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", | ||
| "message": null, | ||
| "errors": [], | ||
| "extra_data": { | ||
| "files_count": 1 | ||
| } | ||
| } | ||
| ], | ||
| "files": [ | ||
| { | ||
| "path": "license-notice.txt", | ||
| "type": "file", | ||
| "licenses": [ | ||
| { | ||
| "key": "unknown-license-reference", | ||
| "score": 27.0, | ||
| "name": "Unknown License file reference", | ||
| "short_name": "Unknown License reference", | ||
| "category": "Unstated License", | ||
| "is_exception": false, | ||
| "is_unknown": true, | ||
| "owner": "Unspecified", | ||
| "homepage_url": null, | ||
| "text_url": "", | ||
| "reference_url": "https://scancode-licensedb.aboutcode.org/unknown-license-reference", | ||
| "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE", | ||
| "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.yml", | ||
| "spdx_license_key": "LicenseRef-scancode-unknown-license-reference", | ||
| "spdx_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE", | ||
| "start_line": 34, | ||
| "end_line": 34, | ||
| "matched_rule": { | ||
| "identifier": "unknown-license-reference_25.RULE", | ||
| "license_expression": "unknown-license-reference", | ||
| "licenses": [ | ||
| "unknown-license-reference" | ||
| ], | ||
| "referenced_filenames": [ | ||
| "LICENSE" | ||
| ], | ||
| "is_license_text": false, | ||
| "is_license_notice": false, | ||
| "is_license_reference": false, | ||
| "is_license_tag": true, | ||
| "is_license_intro": false, | ||
| "has_unknown": true, | ||
| "matcher": "2-aho", | ||
| "rule_length": 5, | ||
| "matched_length": 5, | ||
| "match_coverage": 100.0, | ||
| "rule_relevance": 27 | ||
| }, | ||
| "matched_text": "license\": \"SEE LICENSE IN LICENSE." | ||
| } | ||
| ], | ||
| "license_expressions": [ | ||
| "unknown-license-reference" | ||
| ], | ||
| "percentage_of_license_text": 0.2, | ||
| "scan_errors": [] | ||
| } | ||
| ] | ||
| } |
1 change: 1 addition & 0 deletions
1
tests/licensedcode/data/plugin_license/license_reference/scan/scan-ref/LICENSE
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| that is licensed under [MIT](http://opensource.org/licenses/MIT). |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.