Skip to content

Commit

Permalink
Update tests to fix CI errors
Browse files Browse the repository at this point in the history
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
  • Loading branch information
AyanSinhaMahapatra committed Oct 10, 2023
1 parent e50169f commit d766940
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 81 deletions.
24 changes: 24 additions & 0 deletions src/licensedcode/data/rules/lgpl-2.1_453.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
license_expression: lgpl-2.1
is_license_notice: yes
minimum_coverage: 90
referenced_filenames:
- /usr/share/common-licenses/GPL-2.1
ignorable_urls:
- http://www.gnu.org/licenses/
---

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, version 2.1 of the License.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
The complete text of the GNU Lesser General Public License
can be found in /usr/share/common-licenses/GPL-2.1 file.
7 changes: 7 additions & 0 deletions src/licensedcode/data/rules/mit_1301.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
license_expression: mit
is_license_tag: yes
is_continuous: yes
---

{{"license": "type": "MIT",}}
5 changes: 3 additions & 2 deletions src/licensedcode/data/rules/mpl-2.0_135.RULE
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
license_expression: mpl-2.0
minimum_coverage: 80
is_license_notice: yes
ignorable_urls:
- https://www.mozilla.org/en-US/MPL/2.0/
- https://www.mozilla.org/en-US/MPL/2.0/FAQ
---

licensed under Mozilla Public License Version 2.0 (MPL 2.0). A MPL 2.0
and FAQ's for MPL 2.0 can be found at: https://www.mozilla.org/en-US/MPL/2.0/
licensed under {{Mozilla Public License Version 2.0}} (MPL 2.0). A MPL 2.0
and FAQ's for MPL 2.0 can be found at: {{https://www.mozilla.org/en-US/MPL/2.0/}}
and https://www.mozilla.org/en-US/MPL/2.0/FAQ/.
5 changes: 3 additions & 2 deletions src/licensedcode/data/rules/mpl-2.0_136.RULE
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
license_expression: mpl-2.0
is_license_notice: yes
minimum_coverage: 80
ignorable_urls:
- https://www.mozilla.org/en-US/MPL/2.0/
- https://www.mozilla.org/en-US/MPL/2.0/FAQ
---

is licensed under Mozilla Public License Version 2.0 (MPL 2.0). A MPL 2.0
and FAQ's for MPL 2.0 can be found at: https://www.mozilla.org/en-US/MPL/2.0/
is licensed under {{Mozilla Public License Version 2.0 (MPL 2.0)}}. A MPL 2.0
and FAQ's for MPL 2.0 can be found at: {{https://www.mozilla.org/en-US/MPL/2.0/}}
and https://www.mozilla.org/en-US/MPL/2.0/FAQ/.
10 changes: 7 additions & 3 deletions tests/formattedcode/data/common/manifests-expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ headers:
system_environment:
operating_system: linux
cpu_architecture: 64
platform: Linux-5.15.0-76-generic-x86_64-with-glibc2.29
platform_version: '#83~20.04.1-Ubuntu SMP Wed Jun 21 20:23:31 UTC 2023'
platform: Linux-5.15.0-84-generic-x86_64-with-glibc2.29
platform_version: '#93~20.04.1-Ubuntu SMP Wed Sep 6 16:15:40 UTC 2023'
python_version: "3.8.10 (default, May 26 2023, 14:05:08) \n[GCC 9.4.0]"
spdx_license_list_version: '3.21'
files_count: 4
Expand Down Expand Up @@ -1043,7 +1043,11 @@ license_references:
is_unknown: no
is_generic: no
spdx_license_key: MIT
other_spdx_license_keys: []
other_spdx_license_keys:
- LicenseRef-MIT-Bootstrap
- LicenseRef-MIT-Discord
- LicenseRef-MIT-TC
- LicenseRef-MIT-Diehl
osi_license_key:
text_urls:
- http://opensource.org/licenses/mit-license.php
Expand Down
10 changes: 7 additions & 3 deletions tests/formattedcode/data/yaml/package-and-licenses-expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ headers:
system_environment:
operating_system: linux
cpu_architecture: 64
platform: Linux-5.15.0-76-generic-x86_64-with-glibc2.29
platform_version: '#83~20.04.1-Ubuntu SMP Wed Jun 21 20:23:31 UTC 2023'
platform: Linux-5.15.0-84-generic-x86_64-with-glibc2.29
platform_version: '#93~20.04.1-Ubuntu SMP Wed Sep 6 16:15:40 UTC 2023'
python_version: "3.8.10 (default, May 26 2023, 14:05:08) \n[GCC 9.4.0]"
spdx_license_list_version: '3.21'
files_count: 4
Expand Down Expand Up @@ -322,7 +322,11 @@ license_references:
is_unknown: no
is_generic: no
spdx_license_key: MIT
other_spdx_license_keys: []
other_spdx_license_keys:
- LicenseRef-MIT-Bootstrap
- LicenseRef-MIT-Discord
- LicenseRef-MIT-TC
- LicenseRef-MIT-Diehl
osi_license_key:
text_urls:
- http://opensource.org/licenses/mit-license.php
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
license_expressions:
- apache-2.0
- other-permissive
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
license_expressions:
- apache-2.0
- other-permissive
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
license_expressions:
- x11-tiff
- mit-old-style-no-advert
- other-permissive
- generic-cla
- unknown-license-reference
- unknown-license-reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ license_expressions:
- unknown-license-reference
- proprietary-license
- proprietary-license
- proprietary-license
- warranty-disclaimer
- proprietary-license
- unknown-license-reference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
license_expressions:
- mit
- mit
- embedthis-extension
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@
"is_unknown": false,
"is_generic": false,
"spdx_license_key": "MIT",
"other_spdx_license_keys": [],
"other_spdx_license_keys": [
"LicenseRef-MIT-Bootstrap",
"LicenseRef-MIT-Discord",
"LicenseRef-MIT-TC",
"LicenseRef-MIT-Diehl"
],
"osi_license_key": null,
"text_urls": [
"http://opensource.org/licenses/mit-license.php"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,12 @@
"is_unknown": false,
"is_generic": false,
"spdx_license_key": "MIT",
"other_spdx_license_keys": [],
"other_spdx_license_keys": [
"LicenseRef-MIT-Bootstrap",
"LicenseRef-MIT-Discord",
"LicenseRef-MIT-TC",
"LicenseRef-MIT-Diehl"
],
"osi_license_key": null,
"text_urls": [
"http://opensource.org/licenses/mit-license.php"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
"detection_count": 1,
"detection_log": []
},
{
"identifier": "gpl_1_0_plus-473308ff-72ce-7e72-b3a9-5b1cc6680abb",
"license_expression": "gpl-1.0-plus",
"detection_count": 1,
"detection_log": [
"possible-false-positive",
"not-license-clues-as-more-detections-present"
]
},
{
"identifier": "gpl_2_0_and_apache_2_0_and_lgpl_3_0_plus-c2393e5a-e531-304f-58a9-a6431d46d214",
"license_expression": "gpl-2.0 AND apache-2.0 AND lgpl-3.0-plus",
Expand Down Expand Up @@ -46,8 +37,8 @@
{
"path": "ffmpeg-LICENSE.md",
"type": "file",
"detected_license_expression": "(lgpl-2.1-plus AND other-permissive AND gpl-2.0-plus) AND gpl-1.0-plus AND (lgpl-3.0 AND lgpl-3.0-plus AND (lgpl-3.0 AND gpl-3.0)) AND (ijg AND mit) AND (gpl-2.0 AND apache-2.0 AND lgpl-3.0-plus)",
"detected_license_expression_spdx": "(LGPL-2.1-or-later AND LicenseRef-scancode-other-permissive AND GPL-2.0-or-later) AND GPL-1.0-or-later AND (LGPL-3.0-only AND LGPL-3.0-or-later AND (LGPL-3.0-only AND GPL-3.0-only)) AND (IJG AND MIT) AND (GPL-2.0-only AND Apache-2.0 AND LGPL-3.0-or-later)",
"detected_license_expression": "(lgpl-2.1-plus AND other-permissive AND gpl-2.0-plus) AND (lgpl-3.0 AND lgpl-3.0-plus AND (lgpl-3.0 AND gpl-3.0)) AND (ijg AND mit) AND gpl-1.0-plus AND (gpl-2.0 AND apache-2.0 AND lgpl-3.0-plus)",
"detected_license_expression_spdx": "(LGPL-2.1-or-later AND LicenseRef-scancode-other-permissive AND GPL-2.0-or-later) AND (LGPL-3.0-only AND LGPL-3.0-or-later AND (LGPL-3.0-only AND GPL-3.0-only)) AND (IJG AND MIT) AND GPL-1.0-or-later AND (GPL-2.0-only AND Apache-2.0 AND LGPL-3.0-or-later)",
"license_detections": [
{
"license_expression": "lgpl-2.1-plus AND other-permissive AND gpl-2.0-plus",
Expand All @@ -69,29 +60,6 @@
"detection_log": [],
"identifier": "lgpl_2_1_plus_and_other_permissive_and_gpl_2_0_plus-666058ef-8c38-3b17-d8e7-448b304de833"
},
{
"license_expression": "gpl-1.0-plus",
"matches": [
{
"score": 50.0,
"start_line": 18,
"end_line": 18,
"matched_length": 1,
"match_coverage": 100.0,
"matcher": "2-aho",
"license_expression": "gpl-1.0-plus",
"rule_identifier": "gpl_bare_word_only.RULE",
"rule_relevance": 50,
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl_bare_word_only.RULE",
"matched_text": "gpl."
}
],
"detection_log": [
"possible-false-positive",
"not-license-clues-as-more-detections-present"
],
"identifier": "gpl_1_0_plus-473308ff-72ce-7e72-b3a9-5b1cc6680abb"
},
{
"license_expression": "lgpl-3.0 AND lgpl-3.0-plus AND (lgpl-3.0 AND gpl-3.0)",
"matches": [
Expand Down Expand Up @@ -307,7 +275,7 @@
"matched_text": "LGPL"
}
],
"percentage_of_license_text": 34.96,
"percentage_of_license_text": 34.78,
"scan_errors": []
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ declared_license:
- LGPL-2.1
- MIT(*)
- MIT(**)
declared_license_expression: lgpl-2.1 AND lgpl-2.0-plus
declared_license_expression_spdx: LGPL-2.1-only AND LGPL-2.0-or-later
other_license_expression: (lgpl-2.1 AND lgpl-2.0-plus) AND (gpl-2.0 AND gpl-2.0 AND gpl-2.0)
AND bsd-new AND (isc AND ibm-dhcp) AND xfree86-1.0 AND (gpl-2.0-plus AND gpl-2.0-plus)
other_license_expression_spdx: (LGPL-2.1-only AND LGPL-2.0-or-later) AND (GPL-2.0-only AND GPL-2.0-only
declared_license_expression: lgpl-2.1
declared_license_expression_spdx: LGPL-2.1-only
other_license_expression: (lgpl-2.1 AND lgpl-2.1) AND (gpl-2.0 AND gpl-2.0 AND gpl-2.0) AND
bsd-new AND (isc AND ibm-dhcp) AND xfree86-1.0 AND (gpl-2.0-plus AND gpl-2.0-plus)
other_license_expression_spdx: (LGPL-2.1-only AND LGPL-2.1-only) AND (GPL-2.0-only AND GPL-2.0-only
AND GPL-2.0-only) AND BSD-3-Clause AND (ISC AND LicenseRef-scancode-ibm-dhcp) AND LicenseRef-scancode-xfree86-1.0
AND (GPL-2.0-or-later AND GPL-2.0-or-later)
license_detections: []
Expand Down Expand Up @@ -140,7 +140,7 @@ other_license_detections:
The complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL-2 file.
identifier: gpl_2_0_plus-fe100017-b30d-a3e1-08b9-40cc9f056db5
- license_expression: lgpl-2.1 AND lgpl-2.0-plus
- license_expression: lgpl-2.1
matches:
- score: '100.0'
start_line: 96
Expand All @@ -153,16 +153,16 @@ other_license_detections:
rule_relevance: 100
rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/lgpl-2.1_38.RULE
matched_text: 'License: lgpl-2.1'
- score: '89.68'
- score: '100.0'
start_line: 97
end_line: 110
matched_length: 113
match_coverage: '89.68'
matcher: 3-seq
license_expression: lgpl-2.0-plus
rule_identifier: lgpl-2.0-plus_477.RULE
matched_length: 120
match_coverage: '100.0'
matcher: 1-hash
license_expression: lgpl-2.1
rule_identifier: lgpl-2.1_453.RULE
rule_relevance: 100
rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/lgpl-2.0-plus_477.RULE
rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/lgpl-2.1_453.RULE
matched_text: |
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -177,8 +177,8 @@ other_license_detections:
along with this program. If not, see <http://www.gnu.org/licenses/>.
The complete text of the GNU Lesser General Public License
can be found in /usr/share/common-licenses/
identifier: lgpl_2_1_and_lgpl_2_0_plus-75866488-678a-19bf-7970-6610a46062a1
can be found in /usr/share/common-licenses/GPL-2.1 file.
identifier: lgpl_2_1-eef28a01-301f-7c68-9a3d-06ca8557b06f
- license_expression: isc AND ibm-dhcp
matches:
- score: '100.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,21 @@
]
},
{
"identifier": "apache_2_0-c4e30bcd-ccfd-bbc3-d2f1-196ab911e47d",
"identifier": "apache_2_0-ec8d7936-cda2-7097-40cf-dbe8a06e916e",
"license_expression": "apache-2.0",
"detection_count": 2,
"detection_log": []
},
{
"identifier": "apache_2_0-ec8d7936-cda2-7097-40cf-dbe8a06e916e",
"identifier": "apache_2_0-3972bfb2-eb21-3d0c-d862-1642babb9f95",
"license_expression": "apache-2.0",
"detection_count": 2,
"detection_count": 1,
"detection_log": []
},
{
"identifier": "apache_2_0-c4e30bcd-ccfd-bbc3-d2f1-196ab911e47d",
"license_expression": "apache-2.0",
"detection_count": 1,
"detection_log": []
},
{
Expand Down Expand Up @@ -1448,21 +1454,21 @@
"license_expression": "apache-2.0",
"matches": [
{
"score": 100.0,
"start_line": 3,
"score": 74.36,
"start_line": 1,
"end_line": 13,
"matched_length": 85,
"match_coverage": 100.0,
"matcher": "2-aho",
"matched_length": 87,
"match_coverage": 74.36,
"matcher": "3-seq",
"license_expression": "apache-2.0",
"rule_identifier": "apache-2.0_7.RULE",
"rule_identifier": "apache-2.0_1297.RULE",
"rule_relevance": 100,
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_7.RULE",
"matched_text": "Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License."
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_1297.RULE",
"matched_text": "All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this [file] except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License."
}
],
"detection_log": [],
"identifier": "apache_2_0-c4e30bcd-ccfd-bbc3-d2f1-196ab911e47d"
"identifier": "apache_2_0-3972bfb2-eb21-3d0c-d862-1642babb9f95"
},
{
"license_expression": "apache-2.0",
Expand Down Expand Up @@ -1499,7 +1505,7 @@
}
],
"license_clues": [],
"percentage_of_license_text": 26.1,
"percentage_of_license_text": 26.65,
"scan_errors": []
}
]
Expand Down
2 changes: 1 addition & 1 deletion tests/packagedcode/test_npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def test_npm_scan_with_private_package_json_and_yarn_lock(self):

# FIXME: we should follow the LICENSE file
(['SEE LICENSE IN LICENSE'], 'unknown-license-reference'),
(['For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license.'], 'unknown-license-reference'),
(['For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license.'], '(gpl-2.0-plus AND (gpl-2.0-plus OR lgpl-2.1-plus OR mpl-1.1)) OR commercial-license'),
(['See License in ./LICENSE file'], 'unknown-license-reference'),
]

Expand Down

0 comments on commit d766940

Please sign in to comment.