Skip to content

Commit

Permalink
Rename license match attribute for spdx expression (#3851)
Browse files Browse the repository at this point in the history
* Rename license match attribute for spdx expression

Reference: #3838
Reported-by: Armijn Hemel
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
  • Loading branch information
AyanSinhaMahapatra authored Oct 20, 2024
1 parent 05b9b7f commit 20f3794
Show file tree
Hide file tree
Showing 825 changed files with 5,032 additions and 5,026 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,21 @@ Major API/other changes:
- Output Format Version updated to 4.0.0 (major version bump)
- Dependency attribute rename: ``is_resolved`` renamed to ``is_pinned``
See https://github.com/nexB/scancode-toolkit/pull/3888 for more details.
- License Match attribute rename: ``spdx_license_expression`` is renamed to
``license_expression_spdx``.

Changes in Output Data Structure:

- The data structure of the JSON output has changed for
dependencies at file level package_data, and at top-level.
- The data structure of the JSON output has changed for:
- dependencies at file level package_data, and at top-level.
- license matches at file level or unique codebase level license detections
Note that the change is a modification to the JSON output,
so we have a major version bump ``3.2.0`` to ``4.0.0``:

- Dependency attribute ``is_resolved`` renamed to ``is_pinned``
- LicenseMatch attribute ``spdx_license_expression`` renamed to
``license_expression_spdx``

- Update link references of ownership from nexB to aboutcode-org
See https://github.com/aboutcode-org/scancode-toolkit/issues/3885

Expand Down
6 changes: 3 additions & 3 deletions src/licensedcode/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
The filter functions are executed in a specific sequence over the list of matches.
"""

TRACE = True
TRACE_MERGE = True
TRACE = False
TRACE_MERGE = False
TRACE_REFINE = False
TRACE_FILTER_FALSE_POSITIVE = False
TRACE_FILTER_CONTAINED = False
Expand Down Expand Up @@ -807,7 +807,7 @@ def to_dict(
result = {}

result['license_expression'] = self.rule.license_expression
result['spdx_license_expression'] = self.rule.spdx_license_expression()
result['license_expression_spdx'] = self.rule.spdx_license_expression()
result['from_file'] = file_path
result['start_line'] = self.start_line
result['end_line'] = self.end_line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"matches": [
{
"license_expression": "apache-1.1",
"spdx_license_expression": "Apache-1.1",
"license_expression_spdx": "Apache-1.1",
"from_file": "LICENSE",
"start_line": 7,
"end_line": 70,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"matches": [
{
"license_expression": "pygres-2.2",
"spdx_license_expression": "LicenseRef-scancode-pygres-2.2",
"license_expression_spdx": "LicenseRef-scancode-pygres-2.2",
"from_file": "LICENSE2",
"start_line": 7,
"end_line": 22,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"matches": [
{
"license_expression": "pcre",
"spdx_license_expression": "LicenseRef-scancode-pcre",
"license_expression_spdx": "LicenseRef-scancode-pcre",
"from_file": "LICENSE3",
"start_line": 1,
"end_line": 47,
Expand Down
18 changes: 9 additions & 9 deletions tests/cluecode/data/plugin_filter_clues/filtered-expected4.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"matches": [
{
"license_expression": "gpl-1.0-plus OR artistic-1.0",
"spdx_license_expression": "GPL-1.0-or-later OR Artistic-1.0",
"license_expression_spdx": "GPL-1.0-or-later OR Artistic-1.0",
"from_file": "LICENSE4",
"start_line": 3,
"end_line": 11,
Expand All @@ -178,7 +178,7 @@
},
{
"license_expression": "gpl-1.0",
"spdx_license_expression": "GPL-1.0-only",
"license_expression_spdx": "GPL-1.0-only",
"from_file": "LICENSE4",
"start_line": 13,
"end_line": 13,
Expand All @@ -192,7 +192,7 @@
},
{
"license_expression": "gpl-1.0",
"spdx_license_expression": "GPL-1.0-only",
"license_expression_spdx": "GPL-1.0-only",
"from_file": "LICENSE4",
"start_line": 17,
"end_line": 19,
Expand All @@ -206,7 +206,7 @@
},
{
"license_expression": "gpl-1.0",
"spdx_license_expression": "GPL-1.0-only",
"license_expression_spdx": "GPL-1.0-only",
"from_file": "LICENSE4",
"start_line": 21,
"end_line": 270,
Expand All @@ -220,7 +220,7 @@
},
{
"license_expression": "artistic-1.0",
"spdx_license_expression": "Artistic-1.0",
"license_expression_spdx": "Artistic-1.0",
"from_file": "LICENSE4",
"start_line": 273,
"end_line": 273,
Expand All @@ -234,7 +234,7 @@
},
{
"license_expression": "artistic-1.0",
"spdx_license_expression": "Artistic-1.0",
"license_expression_spdx": "Artistic-1.0",
"from_file": "LICENSE4",
"start_line": 277,
"end_line": 279,
Expand All @@ -248,7 +248,7 @@
},
{
"license_expression": "artistic-1.0",
"spdx_license_expression": "Artistic-1.0",
"license_expression_spdx": "Artistic-1.0",
"from_file": "LICENSE4",
"start_line": 281,
"end_line": 281,
Expand All @@ -262,7 +262,7 @@
},
{
"license_expression": "artistic-1.0",
"spdx_license_expression": "Artistic-1.0",
"license_expression_spdx": "Artistic-1.0",
"from_file": "LICENSE4",
"start_line": 283,
"end_line": 372,
Expand All @@ -276,7 +276,7 @@
},
{
"license_expression": "warranty-disclaimer",
"spdx_license_expression": "LicenseRef-scancode-warranty-disclaimer",
"license_expression_spdx": "LicenseRef-scancode-warranty-disclaimer",
"from_file": "LICENSE4",
"start_line": 374,
"end_line": 376,
Expand Down
44 changes: 22 additions & 22 deletions tests/formattedcode/data/common/manifests-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"matches": [
{
"license_expression": "cddl-1.0",
"spdx_license_expression": "CDDL-1.0",
"license_expression_spdx": "CDDL-1.0",
"from_file": "manifests/maven/persistence-api-1.0.pom",
"start_line": 1,
"end_line": 1,
Expand All @@ -48,7 +48,7 @@
},
{
"license_expression": "cddl-1.0",
"spdx_license_expression": "CDDL-1.0",
"license_expression_spdx": "CDDL-1.0",
"from_file": "manifests/maven/persistence-api-1.0.pom",
"start_line": 2,
"end_line": 2,
Expand Down Expand Up @@ -131,7 +131,7 @@
"matches": [
{
"license_expression": "apache-2.0",
"spdx_license_expression": "Apache-2.0",
"license_expression_spdx": "Apache-2.0",
"from_file": "manifests/npm-license-mapping/package.json",
"start_line": 1,
"end_line": 1,
Expand All @@ -153,7 +153,7 @@
"matches": [
{
"license_expression": "apache-2.0",
"spdx_license_expression": "Apache-2.0",
"license_expression_spdx": "Apache-2.0",
"from_file": "manifests/npm-license-mapping/package.json",
"start_line": 1,
"end_line": 1,
Expand Down Expand Up @@ -236,7 +236,7 @@
"matches": [
{
"license_expression": "mit",
"spdx_license_expression": "MIT",
"license_expression_spdx": "MIT",
"from_file": "manifests/npm-license-string/package.json",
"start_line": 1,
"end_line": 1,
Expand Down Expand Up @@ -325,7 +325,7 @@
"matches": [
{
"license_expression": "lgpl-3.0",
"spdx_license_expression": "LGPL-3.0-only",
"license_expression_spdx": "LGPL-3.0-only",
"from_file": "manifests/pypi/bluepyopt_setup.py",
"start_line": 1,
"end_line": 1,
Expand All @@ -347,7 +347,7 @@
"matches": [
{
"license_expression": "lgpl-3.0",
"spdx_license_expression": "LGPL-3.0-only",
"license_expression_spdx": "LGPL-3.0-only",
"from_file": "manifests/pypi/bluepyopt_setup.py",
"start_line": 1,
"end_line": 1,
Expand Down Expand Up @@ -1152,7 +1152,7 @@
"matches": [
{
"license_expression": "cddl-1.0",
"spdx_license_expression": "CDDL-1.0",
"license_expression_spdx": "CDDL-1.0",
"from_file": "manifests/maven/persistence-api-1.0.pom",
"start_line": 1,
"end_line": 1,
Expand All @@ -1167,7 +1167,7 @@
},
{
"license_expression": "cddl-1.0",
"spdx_license_expression": "CDDL-1.0",
"license_expression_spdx": "CDDL-1.0",
"from_file": "manifests/maven/persistence-api-1.0.pom",
"start_line": 2,
"end_line": 2,
Expand Down Expand Up @@ -1216,7 +1216,7 @@
"matches": [
{
"license_expression": "unknown-license-reference",
"spdx_license_expression": "LicenseRef-scancode-unknown-license-reference",
"license_expression_spdx": "LicenseRef-scancode-unknown-license-reference",
"from_file": "manifests/maven/persistence-api-1.0.pom",
"start_line": 17,
"end_line": 19,
Expand All @@ -1230,7 +1230,7 @@
},
{
"license_expression": "cddl-1.0",
"spdx_license_expression": "CDDL-1.0",
"license_expression_spdx": "CDDL-1.0",
"from_file": "manifests/maven/persistence-api-1.0.pom",
"start_line": 18,
"end_line": 20,
Expand Down Expand Up @@ -1353,7 +1353,7 @@
"matches": [
{
"license_expression": "apache-2.0",
"spdx_license_expression": "Apache-2.0",
"license_expression_spdx": "Apache-2.0",
"from_file": "manifests/npm-license-mapping/package.json",
"start_line": 1,
"end_line": 1,
Expand All @@ -1375,7 +1375,7 @@
"matches": [
{
"license_expression": "apache-2.0",
"spdx_license_expression": "Apache-2.0",
"license_expression_spdx": "Apache-2.0",
"from_file": "manifests/npm-license-mapping/package.json",
"start_line": 1,
"end_line": 1,
Expand Down Expand Up @@ -1537,7 +1537,7 @@
"matches": [
{
"license_expression": "apache-2.0",
"spdx_license_expression": "Apache-2.0",
"license_expression_spdx": "Apache-2.0",
"from_file": "manifests/npm-license-mapping/package.json",
"start_line": 6,
"end_line": 6,
Expand All @@ -1558,7 +1558,7 @@
"matches": [
{
"license_expression": "apache-2.0",
"spdx_license_expression": "Apache-2.0",
"license_expression_spdx": "Apache-2.0",
"from_file": "manifests/npm-license-mapping/package.json",
"start_line": 20,
"end_line": 20,
Expand Down Expand Up @@ -1685,7 +1685,7 @@
"matches": [
{
"license_expression": "mit",
"spdx_license_expression": "MIT",
"license_expression_spdx": "MIT",
"from_file": "manifests/npm-license-string/package.json",
"start_line": 1,
"end_line": 1,
Expand Down Expand Up @@ -1788,7 +1788,7 @@
"matches": [
{
"license_expression": "mit",
"spdx_license_expression": "MIT",
"license_expression_spdx": "MIT",
"from_file": "manifests/npm-license-string/package.json",
"start_line": 4,
"end_line": 4,
Expand Down Expand Up @@ -1919,7 +1919,7 @@
"matches": [
{
"license_expression": "lgpl-3.0",
"spdx_license_expression": "LGPL-3.0-only",
"license_expression_spdx": "LGPL-3.0-only",
"from_file": "manifests/pypi/bluepyopt_setup.py",
"start_line": 1,
"end_line": 1,
Expand All @@ -1941,7 +1941,7 @@
"matches": [
{
"license_expression": "lgpl-3.0",
"spdx_license_expression": "LGPL-3.0-only",
"license_expression_spdx": "LGPL-3.0-only",
"from_file": "manifests/pypi/bluepyopt_setup.py",
"start_line": 1,
"end_line": 1,
Expand Down Expand Up @@ -2110,7 +2110,7 @@
"matches": [
{
"license_expression": "lgpl-3.0",
"spdx_license_expression": "LGPL-3.0-only",
"license_expression_spdx": "LGPL-3.0-only",
"from_file": "manifests/pypi/bluepyopt_setup.py",
"start_line": 9,
"end_line": 20,
Expand All @@ -2131,7 +2131,7 @@
"matches": [
{
"license_expression": "lgpl-3.0",
"spdx_license_expression": "LGPL-3.0-only",
"license_expression_spdx": "LGPL-3.0-only",
"from_file": "manifests/pypi/bluepyopt_setup.py",
"start_line": 65,
"end_line": 65,
Expand All @@ -2152,7 +2152,7 @@
"matches": [
{
"license_expression": "lgpl-3.0",
"spdx_license_expression": "LGPL-3.0-only",
"license_expression_spdx": "LGPL-3.0-only",
"from_file": "manifests/pypi/bluepyopt_setup.py",
"start_line": 74,
"end_line": 75,
Expand Down
Loading

0 comments on commit 20f3794

Please sign in to comment.