diff --git a/src/licensedcode/data/rules/apache-2.0_and_mit_2.RULE b/src/licensedcode/data/rules/apache-2.0_and_mit_2.RULE new file mode 100644 index 00000000000..07ac6fc9dfc --- /dev/null +++ b/src/licensedcode/data/rules/apache-2.0_and_mit_2.RULE @@ -0,0 +1,7 @@ +--- +license_expression: apache-2.0 AND mit +is_license_reference: yes +relevance: 100 +minimum_coverage: 100 +--- +licensed under Apache-2.0 AND MIT diff --git a/src/licensedcode/data/rules/apache-2.0_or_mit_55.RULE b/src/licensedcode/data/rules/apache-2.0_or_mit_55.RULE new file mode 100644 index 00000000000..e68dc305d4c --- /dev/null +++ b/src/licensedcode/data/rules/apache-2.0_or_mit_55.RULE @@ -0,0 +1,7 @@ +--- +license_expression: apache-2.0 OR mit +is_license_reference: yes +relevance: 100 +minimum_coverage: 100 +--- +licensed under Apache-2.0 OR MIT diff --git a/tests/formattedcode/data/common/manifests-expected.yaml b/tests/formattedcode/data/common/manifests-expected.yaml index 219b05fd171..5c67d8cb750 100644 --- a/tests/formattedcode/data/common/manifests-expected.yaml +++ b/tests/formattedcode/data/common/manifests-expected.yaml @@ -11,6 +11,7 @@ headers: --license-references: yes --license-text: yes --package: yes + --processes: -1 --summary: yes --url: yes --yaml: @@ -21,7 +22,7 @@ headers: for any legal advice. ScanCode is a free software code scanning tool from nexB Inc. and others. Visit https://github.com/nexB/scancode-toolkit/ for support and download. - output_format_version: 4.0.0 + output_format_version: 4.1.0 message: errors: [] warnings: [] @@ -29,9 +30,9 @@ headers: system_environment: operating_system: linux cpu_architecture: 64 - platform: Linux-5.15.0-141-generic-x86_64-with-glibc2.35 - platform_version: '#151-Ubuntu SMP Sun May 18 21:35:19 UTC 2025' - python_version: 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] + platform: Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.39 + platform_version: '#1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025' + python_version: 3.12.3 (main, Jan 8 2026, 11:30:50) [GCC 13.3.0] spdx_license_list_version: '3.27' files_count: 4 summary: diff --git a/tests/formattedcode/data/yaml/package-and-licenses-expected.yaml b/tests/formattedcode/data/yaml/package-and-licenses-expected.yaml index 1c5d687e52f..00f0e664caf 100644 --- a/tests/formattedcode/data/yaml/package-and-licenses-expected.yaml +++ b/tests/formattedcode/data/yaml/package-and-licenses-expected.yaml @@ -11,6 +11,7 @@ headers: --license-references: yes --license-text: yes --package: yes + --processes: -1 --summary: yes --url: yes --yaml: @@ -21,7 +22,7 @@ headers: for any legal advice. ScanCode is a free software code scanning tool from nexB Inc. and others. Visit https://github.com/nexB/scancode-toolkit/ for support and download. - output_format_version: 4.0.0 + output_format_version: 4.1.0 message: errors: [] warnings: [] @@ -29,9 +30,9 @@ headers: system_environment: operating_system: linux cpu_architecture: 64 - platform: Linux-5.15.0-141-generic-x86_64-with-glibc2.35 - platform_version: '#151-Ubuntu SMP Sun May 18 21:35:19 UTC 2025' - python_version: 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] + platform: Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.39 + platform_version: '#1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025' + python_version: 3.12.3 (main, Jan 8 2026, 11:30:50) [GCC 13.3.0] spdx_license_list_version: '3.27' files_count: 4 summary: @@ -47,7 +48,7 @@ summary: declared_holder: Example Corp. primary_language: Python other_license_expressions: - - value: apache-2.0 AND (apache-2.0 OR mit) + - value: apache-2.0 OR mit count: 1 - value: mit count: 1 @@ -316,24 +317,11 @@ license_detections: rule_identifier: apache-2.0_65.RULE rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_65.RULE matched_text: license = Apache-2.0 - - identifier: apache_2_0_and__apache_2_0_or_mit-ab5115d2-1eff-af76-1473-34378a32b2bb - license_expression: apache-2.0 AND (apache-2.0 OR mit) - license_expression_spdx: Apache-2.0 AND (Apache-2.0 OR MIT) + - identifier: apache_2_0_or_mit-63aee60b-3389-cc69-da5a-7dd28d1b8e2e + license_expression: apache-2.0 OR mit + license_expression_spdx: Apache-2.0 OR MIT detection_count: 1 reference_matches: - - license_expression: apache-2.0 - license_expression_spdx: Apache-2.0 - from_file: package-and-licenses/README.txt - start_line: 3 - end_line: 3 - matcher: 2-aho - score: '100.0' - matched_length: 5 - match_coverage: '100.0' - rule_relevance: 100 - rule_identifier: apache-2.0_1109.RULE - rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_1109.RULE - matched_text: This is licensed under Apache-2.0 or MIT - license_expression: apache-2.0 OR mit license_expression_spdx: Apache-2.0 OR MIT from_file: package-and-licenses/README.txt @@ -341,11 +329,11 @@ license_detections: end_line: 3 matcher: 2-aho score: '100.0' - matched_length: 5 + matched_length: 7 match_coverage: '100.0' rule_relevance: 100 - rule_identifier: apache-2.0_or_mit_36.RULE - rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_36.RULE + rule_identifier: apache-2.0_or_mit_55.RULE + rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_55.RULE matched_text: This is licensed under Apache-2.0 or MIT - identifier: mit-cacd5c0c-204a-85c2-affc-e4c125b2492a license_expression: mit @@ -356,7 +344,7 @@ license_detections: license_expression_spdx: MIT from_file: package-and-licenses/mit.LICENSE start_line: 2 - end_line: '19' + end_line: 19 matcher: 1-hash score: '100.0' matched_length: 161 @@ -846,33 +834,6 @@ license_rule_references: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - - license_expression: apache-2.0 - identifier: apache-2.0_1109.RULE - language: en - rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_1109.RULE - is_license_text: no - is_license_notice: yes - is_license_reference: no - is_license_tag: no - is_license_intro: no - is_license_clue: no - is_required_phrase: no - skip_for_required_phrase_generation: no - is_continuous: no - is_builtin: yes - is_from_license: no - is_synthetic: no - length: 5 - relevance: 100 - minimum_coverage: 80 - referenced_filenames: [] - notes: - ignorable_copyrights: [] - ignorable_holders: [] - ignorable_authors: [] - ignorable_urls: [] - ignorable_emails: [] - text: licenced under {{Apache 2.0}} - license_expression: apache-2.0 identifier: apache-2.0_65.RULE language: en @@ -901,22 +862,22 @@ license_rule_references: ignorable_emails: [] text: license="Apache-2.0 - license_expression: apache-2.0 OR mit - identifier: apache-2.0_or_mit_36.RULE + identifier: apache-2.0_or_mit_55.RULE language: en - rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_36.RULE + rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_55.RULE is_license_text: no is_license_notice: no is_license_reference: yes is_license_tag: no is_license_intro: no is_license_clue: no - is_required_phrase: yes + is_required_phrase: no skip_for_required_phrase_generation: no is_continuous: no is_builtin: yes is_from_license: no is_synthetic: no - length: 5 + length: 7 relevance: 100 minimum_coverage: 80 referenced_filenames: [] @@ -926,7 +887,8 @@ license_rule_references: ignorable_authors: [] ignorable_urls: [] ignorable_emails: [] - text: apache-2.0 OR MIT + text: | + licensed under Apache-2.0 OR MIT - license_expression: mit identifier: mit.LICENSE language: en @@ -1069,25 +1031,12 @@ files: package_data: [] for_packages: - pkg:pypi/codebase?uuid=fixed-uid-done-for-testing-5642512d1758 - detected_license_expression: apache-2.0 AND (apache-2.0 OR mit) - detected_license_expression_spdx: Apache-2.0 AND (Apache-2.0 OR MIT) + detected_license_expression: apache-2.0 OR mit + detected_license_expression_spdx: Apache-2.0 OR MIT license_detections: - - license_expression: apache-2.0 AND (apache-2.0 OR mit) - license_expression_spdx: Apache-2.0 AND (Apache-2.0 OR MIT) + - license_expression: apache-2.0 OR mit + license_expression_spdx: Apache-2.0 OR MIT matches: - - license_expression: apache-2.0 - license_expression_spdx: Apache-2.0 - from_file: package-and-licenses/README.txt - start_line: 3 - end_line: 3 - matcher: 2-aho - score: '100.0' - matched_length: 5 - match_coverage: '100.0' - rule_relevance: 100 - rule_identifier: apache-2.0_1109.RULE - rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_1109.RULE - matched_text: This is licensed under Apache-2.0 or MIT - license_expression: apache-2.0 OR mit license_expression_spdx: Apache-2.0 OR MIT from_file: package-and-licenses/README.txt @@ -1095,13 +1044,13 @@ files: end_line: 3 matcher: 2-aho score: '100.0' - matched_length: 5 + matched_length: 7 match_coverage: '100.0' rule_relevance: 100 - rule_identifier: apache-2.0_or_mit_36.RULE - rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_36.RULE + rule_identifier: apache-2.0_or_mit_55.RULE + rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_or_mit_55.RULE matched_text: This is licensed under Apache-2.0 or MIT - identifier: apache_2_0_and__apache_2_0_or_mit-ab5115d2-1eff-af76-1473-34378a32b2bb + identifier: apache_2_0_or_mit-63aee60b-3389-cc69-da5a-7dd28d1b8e2e license_clues: [] percentage_of_license_text: '50.0' copyrights: @@ -1324,8 +1273,8 @@ files: start_line: 4 end_line: 4 - url: http://www.apache.org/licenses/LICENSE-2.0 - start_line: '196' - end_line: '196' + start_line: 196 + end_line: 196 files_count: '0' dirs_count: '0' size_count: '0' @@ -1368,7 +1317,7 @@ files: license_expression_spdx: MIT from_file: package-and-licenses/mit.LICENSE start_line: 2 - end_line: '19' + end_line: 19 matcher: 1-hash score: '100.0' matched_length: 161 diff --git a/tests/formattedcode/data/yaml/simple-expected.yaml b/tests/formattedcode/data/yaml/simple-expected.yaml index 9bbe9dda588..2f510f89352 100644 --- a/tests/formattedcode/data/yaml/simple-expected.yaml +++ b/tests/formattedcode/data/yaml/simple-expected.yaml @@ -6,6 +6,7 @@ headers: --info: yes --license: yes --package: yes + --processes: -1 --yaml: notice: | Generated with ScanCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES @@ -14,7 +15,7 @@ headers: for any legal advice. ScanCode is a free software code scanning tool from nexB Inc. and others. Visit https://github.com/nexB/scancode-toolkit/ for support and download. - output_format_version: 4.0.0 + output_format_version: 4.1.0 message: errors: [] warnings: [] @@ -22,9 +23,9 @@ headers: system_environment: operating_system: linux cpu_architecture: 64 - platform: Linux-5.15.0-141-generic-x86_64-with-glibc2.35 - platform_version: '#151-Ubuntu SMP Sun May 18 21:35:19 UTC 2025' - python_version: 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] + platform: Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.39 + platform_version: '#1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025' + python_version: 3.12.3 (main, Jan 8 2026, 11:30:50) [GCC 13.3.0] spdx_license_list_version: '3.27' files_count: 1 packages: [] diff --git a/tests/licensedcode/data/datadriven/lic1/apache-2.0_and_mit_issue_4690.txt b/tests/licensedcode/data/datadriven/lic1/apache-2.0_and_mit_issue_4690.txt new file mode 100644 index 00000000000..caa2b2f1d68 --- /dev/null +++ b/tests/licensedcode/data/datadriven/lic1/apache-2.0_and_mit_issue_4690.txt @@ -0,0 +1 @@ +licensed under Apache-2.0 AND MIT diff --git a/tests/licensedcode/data/datadriven/lic1/apache-2.0_and_mit_issue_4690.txt.yml b/tests/licensedcode/data/datadriven/lic1/apache-2.0_and_mit_issue_4690.txt.yml new file mode 100644 index 00000000000..1018a59980f --- /dev/null +++ b/tests/licensedcode/data/datadriven/lic1/apache-2.0_and_mit_issue_4690.txt.yml @@ -0,0 +1,2 @@ +license_expressions: + - apache-2.0 AND mit diff --git a/tests/licensedcode/data/datadriven/lic1/apache-2.0_or_mit_issue_4690.txt b/tests/licensedcode/data/datadriven/lic1/apache-2.0_or_mit_issue_4690.txt new file mode 100644 index 00000000000..66da0b480fc --- /dev/null +++ b/tests/licensedcode/data/datadriven/lic1/apache-2.0_or_mit_issue_4690.txt @@ -0,0 +1 @@ +licensed under Apache-2.0 OR MIT diff --git a/tests/licensedcode/data/datadriven/lic1/apache-2.0_or_mit_issue_4690.txt.yml b/tests/licensedcode/data/datadriven/lic1/apache-2.0_or_mit_issue_4690.txt.yml new file mode 100644 index 00000000000..76a7f25647d --- /dev/null +++ b/tests/licensedcode/data/datadriven/lic1/apache-2.0_or_mit_issue_4690.txt.yml @@ -0,0 +1,2 @@ +license_expressions: + - apache-2.0 OR mit