Skip to content

Commit

Permalink
Feature/add config params (#71)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
ant-u authored Jan 13, 2025
1 parent 38e165a commit 84540e2
Show file tree
Hide file tree
Showing 23 changed files with 501 additions and 402 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ graph TD

This checks:

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

## Usage

Expand All @@ -71,7 +73,7 @@ ros_license_toolkit my_ros_package

```bash
$ ros_license_toolkit -h
usage: ros_license_toolkit [-h] [-c] [-v] [-q] path
usage: ros_license_toolkit [-h] [-c] [-v] [-q] [-e] [-w] path

Checks ROS packages for correct license declaration.

Expand All @@ -84,6 +86,11 @@ options:
generate a copyright file
-v, --verbose enable verbose output
-q, --quiet disable most output
-e, --continue_on_error
treats all errors as warnings, i.e. will give
returncode 0 even on errors
-w, --warnings_as_error
treats all warnings as errors
```

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

## License

Expand Down
89 changes: 0 additions & 89 deletions schemas/package_common.xsd

This file was deleted.

69 changes: 0 additions & 69 deletions schemas/package_format1.xsd

This file was deleted.

73 changes: 0 additions & 73 deletions schemas/package_format2.xsd

This file was deleted.

Loading

0 comments on commit 84540e2

Please sign in to comment.