Skip to content

Commit 84540e2

Browse files
authored
Feature/add config params (#71)
* changed each test to also check for warnings and specified which warning must be displayed Signed-off-by: Anton Utz <uta5fe@bosch.com> * implemented change requests Signed-off-by: Anton Utz <uta5fe@bosch.com> * linter issues Signed-off-by: Anton Utz <uta5fe@bosch.com> * added location of check Signed-off-by: Anton Utz <uta5fe@bosch.com> * added check class Signed-off-by: Anton Utz <uta5fe@bosch.com> * added test for xml conformity Signed-off-by: Anton Utz <uta5fe@bosch.com> * added check for validating xml with scheme, output not yet processed though Signed-off-by: Anton Utz <uta5fe@bosch.com> * created whole check out of validation function. introduced success and failure messages Signed-off-by: Anton Utz <uta5fe@bosch.com> * corrected double code Signed-off-by: Anton Utz <uta5fe@bosch.com> * moved check to extra file Signed-off-by: Anton Utz <uta5fe@bosch.com> * fixed imports and whitespaces Signed-off-by: Anton Utz <uta5fe@bosch.com> * changed if structure of _check method Signed-off-by: Anton Utz <uta5fe@bosch.com> * changed tests to all fullfill scheme version Signed-off-by: Anton Utz <uta5fe@bosch.com> * changed test data with source-file attribute to version 4 Signed-off-by: Anton Utz <uta5fe@bosch.com> * added case for package.xml version 4 Signed-off-by: Anton Utz <uta5fe@bosch.com> * removed todo Signed-off-by: Anton Utz <uta5fe@bosch.com> * adapted wrong test Signed-off-by: Anton Utz <uta5fe@bosch.com> * moved version checking and xml tree conversion to package.py Signed-off-by: Anton Utz <uta5fe@bosch.com> * refactor of schema check Signed-off-by: Anton Utz <uta5fe@bosch.com> * fixed bug Signed-off-by: Anton Utz <uta5fe@bosch.com> * added new args for config Signed-off-by: Anton Utz <uta5fe@bosch.com> * added functionality for config options Signed-off-by: Anton Utz <uta5fe@bosch.com> * added scheme 2 test Signed-off-by: Anton Utz <uta5fe@bosch.com> * added tests for all scheme versions Signed-off-by: Anton Utz <uta5fe@bosch.com> * added negative, violating tests for every scheme Signed-off-by: Anton Utz <uta5fe@bosch.com> * adapted tests to scan for schemacheck as well Signed-off-by: Anton Utz <uta5fe@bosch.com> * added online schema aquiration Signed-off-by: Anton Utz <uta5fe@bosch.com> * changed used xml validation files with online files, still need a fallback to offline Signed-off-by: Anton Utz <uta5fe@bosch.com> * changed readme due to updates on code Signed-off-by: Anton Utz <uta5fe@bosch.com> * changed readme Signed-off-by: Anton Utz <uta5fe@bosch.com> * changed content of arguments help Signed-off-by: Anton Utz <uta5fe@bosch.com> * added lazy schema request Signed-off-by: Anton Utz <uta5fe@bosch.com> * saving validation schema to reduce requests Signed-off-by: Anton Utz <uta5fe@bosch.com> * deleted local shema files, rewrote schema_check cases and adapted schema checks to not be downwards compatible Signed-off-by: Anton Utz <uta5fe@bosch.com> * implemented suggestions again Signed-off-by: Anton Utz <uta5fe@bosch.com> * implemented suggestions Signed-off-by: Anton Utz <uta5fe@bosch.com> * added fail case for no connection & adapted readme Signed-off-by: Anton Utz <uta5fe@bosch.com> * linter issues Signed-off-by: Anton Utz <uta5fe@bosch.com> * fixing documentation bug Signed-off-by: Anton Utz <uta5fe@bosch.com> * documentation fix Signed-off-by: Anton Utz <uta5fe@bosch.com> --------- Signed-off-by: Anton Utz <uta5fe@bosch.com>
1 parent 38e165a commit 84540e2

File tree

23 files changed

+501
-402
lines changed

23 files changed

+501
-402
lines changed

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ graph TD
3838

3939
This checks:
4040

41+
- [x] Is `package.xml` conform to it's schema?
42+
[- SchemaCheck](src/ros_license_toolkit/license_checks/schema_check.py#L27)
4143
- [x] Is any license defined in `package.xml`?
42-
[- LicenseTagExistsCheck](src/ros_license_toolkit/checks.py#L90)
44+
[- LicenseTagExistsCheck](src/ros_license_toolkit/license_checks/license_tag_exists_check.py#L24)
4345
- [x] Has at most one license tag without a source-files declaration?
44-
[- LicenseTagExistsCheck](src/ros_license_toolkit/checks.py#L90)
46+
[- LicenseTagExistsCheck](src/ros_license_toolkit/license_checks/license_tag_exists_check.py#L24)
4547
- [x] Do all licenses tags follow the SPDX standard?
46-
[- LicenseTagIsInSpdxListCheck](src/ros_license_toolkit/checks.py#L104)
48+
[- LicenseTagIsInSpdxListCheck](src/ros_license_toolkit/license_checks/license_tag_is_spdx.py#L24)
4749
- [x] Are license texts available and correctly referenced for all declared licenses?
48-
[- LicenseTextExistsCheck](src/ros_license_toolkit/checks.py#L123)
50+
[- LicenseTextExistsCheck](src/ros_license_toolkit/license_checks/license_text_exists_check.py#L30)
4951
- [x] Does the code contain licenses not declared in any license tags source-file attribute (source-files="src/something/**")?
50-
[- LicensesInCodeCheck](src/ros_license_toolkit/checks.py#L182)
52+
[- LicensesInCodeCheck](src/ros_license_toolkit/license_checks/license_in_code_check.py#L28)
5153

5254
## Usage
5355

@@ -71,7 +73,7 @@ ros_license_toolkit my_ros_package
7173

7274
```bash
7375
$ ros_license_toolkit -h
74-
usage: ros_license_toolkit [-h] [-c] [-v] [-q] path
76+
usage: ros_license_toolkit [-h] [-c] [-v] [-q] [-e] [-w] path
7577

7678
Checks ROS packages for correct license declaration.
7779

@@ -84,6 +86,11 @@ options:
8486
generate a copyright file
8587
-v, --verbose enable verbose output
8688
-q, --quiet disable most output
89+
-e, --continue_on_error
90+
treats all errors as warnings, i.e. will give
91+
returncode 0 even on errors
92+
-w, --warnings_as_error
93+
treats all warnings as errors
8794
```
8895

8996
Additionally, there is an option to ignore single files, folders and types of files.
@@ -140,9 +147,9 @@ In particular, the following things will have to be done:
140147
- [x] Each LicenseTag should have SPDX id.
141148
- [x] Single license tag without file attribute and single license text should match automatically.
142149
- [x] Turn into github action.
143-
- [ ] Evaluate runtime. If scancode-toolkit takes too long on too many cases, we will have to look for an alternative.
150+
- [x] Evaluate runtime. If scancode-toolkit takes too long on too many cases, we will have to look for an alternative.
151+
- [x] Error of `LicenseTagIsInSpdxListCheck` must be a warning
144152
- [ ] Idea: Create pull requests for package maintainers automatically.
145-
- [ ] Error of `LicenseTagIsInSpdxListCheck` must be a warning
146153

147154
## License
148155

schemas/package_common.xsd

Lines changed: 0 additions & 89 deletions
This file was deleted.

schemas/package_format1.xsd

Lines changed: 0 additions & 69 deletions
This file was deleted.

schemas/package_format2.xsd

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)