Skip to content
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

Feature/error for spdx license and tag #54

Merged
merged 33 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
be4a47c
Update scancode-toolkit requirement from <=31.2.6 to <=32.0.7
dependabot[bot] Oct 2, 2023
53dc988
working from 32.0.7
ct2034 Oct 9, 2023
85df286
is_license_text check fixed with new result semantics
ct2034 Oct 9, 2023
db494df
linting fix
ct2034 Oct 9, 2023
ca0e3e1
handling of ignored files
ct2034 Oct 9, 2023
c53c22b
formatting
ct2034 Oct 9, 2023
073e6fb
this is all WIP
ct2034 Oct 9, 2023
6555c19
Merge branch 'main' into dependabot/pip/scancode-toolkit-lte-32.0.7
ct2034 Oct 30, 2023
5312b77
Unnecessary "else" after "return"
ct2034 Oct 30, 2023
d747147
still bad with 32.0.8
ct2034 Oct 30, 2023
8f18304
ignoring those rules
ct2034 Oct 30, 2023
dada029
Merge branch 'main' into dependabot/pip/scancode-toolkit-lte-32.0.7
ant-u Feb 23, 2024
f633c28
changed method get_spdx_license_name back, WIP
ant-u Feb 23, 2024
1e7a499
scancode get_copyrights function filtering word 'anything', changed t…
ant-u Feb 27, 2024
b5d3b25
linter issues
ant-u Feb 27, 2024
fd8d6de
Added spaces around comment for scancode to recognize copyright message
ant-u Feb 27, 2024
af457d3
Merge branch 'main' of https://github.com/boschresearch/ros_license_t…
ant-u Feb 27, 2024
648de94
added check for only one license text which is in spdx to start handl…
ant-u Mar 4, 2024
59be16e
When only one SPDX License File exists, make a warning to change the …
ant-u Mar 4, 2024
27393ff
Added check if multiple files exist
ant-u Mar 5, 2024
28cede1
restructured LicenseTextExistsCheck
ant-u Mar 5, 2024
eec394c
reverted restructure of check since pytest has trouble with it
ant-u Mar 5, 2024
b7859b4
moved LicenseTextExists checks to seperate function
ant-u Mar 6, 2024
9aefe6a
made own evaluation function for licenseInCodeCheck
ant-u Mar 6, 2024
945cd93
added irgnore flag for too many attributes localy to package.py since…
ant-u Mar 6, 2024
622738e
Converted check_licenses mehtod to function
ant-u Mar 6, 2024
75c2d63
restructured Check LicensesInCode and TextExists to work with attribu…
ant-u Mar 6, 2024
6c9ba21
added test for two licenses with both tags not in spdx
ant-u Mar 6, 2024
5af585d
changed license from test to MPL
ant-u Mar 6, 2024
89f05d9
Added negative test for two not in spdx tags but one for own license …
ant-u Mar 6, 2024
065ff46
changed check for LicenceTag to Fail if tag and file are not same lic…
ant-u Mar 12, 2024
2c861e9
Merge branch 'main' into feature/error_for_spdx_license_and_tag
ant-u Mar 18, 2024
cecde49
deleted unnecessary attribute from pull request
ant-u Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/ros_license_toolkit/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,16 @@ def _check_licenses(self, package: Package) -> None:
f"License text file '{license_text_file}' is " +\
f"of license {actual_license} but tag is " +\
f"{license_tag.get_license_id()}."
self.missing_license_texts_status[license_tag] = Status.WARNING
# If Tag and File both are in SPDX but don't match -> Error
if is_license_name_in_spdx_list(license_tag.get_license_id()):
self.missing_license_texts_status[license_tag] =\
Status.FAILURE
else:
self.missing_license_texts_status[license_tag] =\
Status.WARNING
self.files_with_wrong_tags[license_tag] = \
{'actual_license': actual_license,
'license_tag': license_tag.get_license_id()}
continue

def _evaluate_results(self):
Expand Down
7 changes: 3 additions & 4 deletions test/systemtest/test_separate_pkgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,9 @@ def test_pkg_with_multiple_licenses_one_referenced_incorrect(self):

def test_pkg_wrong_license_file(self):
"""Test on a package with a license text file that does not match
the license declared in the package.xml."""
process, stdout = open_subprocess("test_pkg_wrong_license_file")
self.assertEqual(os.EX_OK, process.returncode)
self.assertIn(b"WARNING", stdout)
the license declared in the package.xml, both tag and file in spdx"""
self.assertEqual(os.EX_DATAERR, main(
["test/_test_data/test_pkg_wrong_license_file"]))


def open_subprocess(test_data_name: str):
Expand Down
Loading