Skip to content

Commit

Permalink
Updating linters (#72)
Browse files Browse the repository at this point in the history
* using pre-commit in ci

Signed-off-by: Christian Henkel <[email protected]>

* new pre-commit config

Signed-off-by: Christian Henkel <[email protected]>

* codespell

Signed-off-by: Christian Henkel <[email protected]>

* no flake8

Signed-off-by: Christian Henkel <[email protected]>

* black, isort

Signed-off-by: Christian Henkel <[email protected]>

* pylint

Signed-off-by: Christian Henkel <[email protected]>

* new python versions

Signed-off-by: Christian Henkel <[email protected]>

* making copyright files nor trigger linters

Signed-off-by: Christian Henkel <[email protected]>

---------

Signed-off-by: Christian Henkel <[email protected]>
  • Loading branch information
ct2034 authored Jan 15, 2025
1 parent 84540e2 commit 003e79f
Show file tree
Hide file tree
Showing 81 changed files with 878 additions and 845 deletions.
42 changes: 15 additions & 27 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
build:
name: py${{ matrix.python-version }} @ ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.7"
os: "ubuntu-20.04"
- python-version: "3.7"
os: "ubuntu-22.04"
- python-version: "3.8"
os: "ubuntu-20.04"
- python-version: "3.8"
os: "ubuntu-22.04"
# versions updated according to
# https://devguide.python.org/versions/
# on 2025-01-15
- python-version: "3.9"
os: "ubuntu-22.04"
- python-version: "3.10"
os: "ubuntu-22.04"
- python-version: "3.11"
os: "ubuntu-22.04"
- python-version: "3.12"
os: "ubuntu-22.04"
- python-version: "3.13"
os: "ubuntu-22.04"
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}
Expand All @@ -43,21 +44,8 @@ jobs:
- name: Update pip
run: |
pip install --upgrade pip
pip install setuptools_rust
- name: Install dependencies
run: pip install .
- uses: ricardochaves/[email protected]
with:
python-root-list: "src/ test/"
use-pylint: true
use-pycodestyle: true
use-flake8: true
use-black: false
use-mypy: true
use-isort: true
extra-pylint-options: ""
extra-pycodestyle-options: ""
extra-flake8-options: ""
extra-black-options: ""
extra-mypy-options: "--ignore-missing-imports"
extra-isort-options: ""
- name: Install packages
run: |
pip install .
- name: Pre-commit
uses: pre-commit/[email protected]
12 changes: 6 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ jobs:
fail-fast: false
matrix:
include:
# versions updated accoring to
# versions updated according to
# https://devguide.python.org/versions/
# on 2023-07-12
- python-version: "3.8"
os: "ubuntu-20.04"
- python-version: "3.8"
os: "ubuntu-22.04"
# on 2025-01-15
- python-version: "3.9"
os: "ubuntu-22.04"
- python-version: "3.10"
os: "ubuntu-22.04"
- python-version: "3.11"
os: "ubuntu-22.04"
- python-version: "3.12"
os: "ubuntu-22.04"
- python-version: "3.13"
os: "ubuntu-22.04"
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ jobs:
fail-fast: true
matrix:
include:
# versions updated accoring to
# versions updated according to
# https://devguide.python.org/versions/
# on 2023-07-12
- python-version: "3.8"
os: "ubuntu-20.04"
- python-version: "3.8"
os: "ubuntu-22.04"
# on 2025-01-15
- python-version: "3.9"
os: "ubuntu-22.04"
- python-version: "3.10"
os: "ubuntu-22.04"
- python-version: "3.11"
os: "ubuntu-22.04"
- python-version: "3.12"
os: "ubuntu-22.04"
- python-version: "3.13"
os: "ubuntu-22.04"
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}
Expand Down Expand Up @@ -74,4 +74,3 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: dist

2 changes: 1 addition & 1 deletion .github/workflows/todo-to-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
steps:
- uses: "actions/checkout@v3"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@v4"
uses: "alstr/todo-to-issue-action@v4"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ __pycache__/
build/
.coverage*
coverage.xml
dist/
dist/
89 changes: 55 additions & 34 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,56 @@
repos:
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [ python ]
files: ^(src/|test/)
- id: pycodestyle
name: pycodestyle
entry: pycodestyle
language: system
types: [ python ]
files: ^(src/|test/)
- id: flake8
name: flake8
entry: flake8
language: system
types: [ python ]
files: ^(src/|test/)
- id: mypy
name: mypy
entry: mypy
args:
- "--ignore-missing-imports"
language: system
types: [ python ]
files: ^(src/|test/)
- id: isort
name: isort
entry: isort
language: system
types: [ python ]
files: ^(src/|test/)
# general
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: forbid-new-submodules
- id: mixed-line-ending
- id: name-tests-test
- id: requirements-txt-fixer
- id: sort-simple-yaml
- id: trailing-whitespace
# static analysis
- repo: https://github.com/pycqa/pylint
rev: v3.3.1
hooks:
- id: pylint
# type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
# spelling
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli # required to read config from pyproject.toml
# auto-formatting
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
language_version: python3.10
# import sorting
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Contributing
Contributions to this are very welcome.
We are especially interested in feedback on scan results that you got from a
Contributions to this are very welcome.
We are especially interested in feedback on scan results that you got from a
package, please make then a PR with:
* Package / Repo you are testing with commit hash
* Scan results you got (ideally with `-v`)
* What did not match you expectations?

In terms of code changes, we follow the standard GitHub pull request model.
In terms of code changes, we follow the standard GitHub pull request model.
For large contributions we do encourage you to file a ticket in
the GitHub issues tracking system prior to any code development to coordinate
with the development team early in the process. Coordinating up
Expand Down
4 changes: 1 addition & 3 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is the official list of ros_license_toolkit copyright holders and
# This is the official list of ros_license_toolkit copyright holders and
# authors.
#
# Often employers or academic institutions have ownership over code that is
Expand All @@ -23,5 +23,3 @@

Robert Bosch GmbH
Christian Henkel <[email protected]>


12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/boschresearch/ros_license_toolkit/pytest.yml?label=pytest&style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/actions/workflows/pytest.yml)
[![github lint](https://img.shields.io/github/actions/workflow/status/boschresearch/ros_license_toolkit/lint.yml?label=lint&style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/actions/workflows/lint.yml)
[![GitHub issues](https://img.shields.io/github/issues/boschresearch/ros_license_toolkit.svg?style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/issues)
[![GitHub prs](https://img.shields.io/github/issues-pr/boschresearch/ros_license_toolkit.svg?style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/pulls)
[![GitHub issues](https://img.shields.io/github/issues/boschresearch/ros_license_toolkit.svg?style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/issues)
[![GitHub prs](https://img.shields.io/github/issues-pr/boschresearch/ros_license_toolkit.svg?style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/pulls)
[![PyPI](https://img.shields.io/pypi/v/ros_license_toolkit?style=flat-square)](https://pypi.org/project/ros-license-toolkit/)
[![python](https://img.shields.io/github/languages/top/boschresearch/ros_license_toolkit.svg?style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/search?l=python)
[![python](https://img.shields.io/github/languages/top/boschresearch/ros_license_toolkit.svg?style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/search?l=python)
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg?style=flat-square)](https://github.com/boschresearch/ros_license_toolkit/blob/main/LICENSE)

> **Warning**
Expand All @@ -24,7 +24,7 @@ ROS packages must have licenses. This tool checks if the license declarations in
```mermaid
graph TD
classDef stroke stroke:#333,stroke-width:2px;
s([scan code for licenses and copyrights])
s([scan code for licenses and copyrights])
class s stroke
p[compare to\n package.xml\nfor linting]
class p stroke
Expand Down Expand Up @@ -94,8 +94,8 @@ options:
```

Additionally, there is an option to ignore single files, folders and types of files.
If there exists a `.scanignore` in the **top level directory** of a package,
everything in it is going to be ignored.
If there exists a `.scanignore` in the **top level directory** of a package,
everything in it is going to be ignored.
The file entries work similar to a `.gitignore` file, including making comments with `#`.
One Example for a custom `.scanignore` file:

Expand Down
Loading

0 comments on commit 003e79f

Please sign in to comment.