diff --git a/.flake8 b/.flake8 index dc1fd6c..dcc8dce 100644 --- a/.flake8 +++ b/.flake8 @@ -1,8 +1,2 @@ [flake8] -max-line-length = 120 -exclude = - .git, - __pycache__, - .venv, - # Ignore generated *_pb2.py files - gen_proto, *_pb2* +max_line_length = 120 diff --git a/.github/workflows/check_license.yml b/.github/workflows/check_license.yml new file mode 100755 index 0000000..92a7d9f --- /dev/null +++ b/.github/workflows/check_license.yml @@ -0,0 +1,34 @@ +name: spdx + +on: + pull_request + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + check-spdx-headers: + runs-on: ubuntu-latest + + steps: + + - name: Checkout code + uses: actions/checkout@v4 + with: + # required to grab the history of the PR + fetch-depth: 0 + submodules: 'true' + + - name: Get changed files + run: | + echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | tr '\n' ',')" >> $GITHUB_ENV + + - name: Set license + run: | + echo "licenses=Apache-2.0" >> $GITHUB_ENV + + - uses: eclipse-kuksa/kuksa-actions/spdx@2 + with: + files: "${{ env.files }}" + licenses: "${{ env.licenses }}" diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..537e748 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,24 @@ +name: pre-commit + +on: [pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + pre-commit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + # required to grab the history of the PR + fetch-depth: 0 + submodules: 'true' + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - uses: pre-commit/action@v3.0.1 + with: + extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..3e4edcc --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + exclude_types: ["dbc"] + - id: end-of-file-fixer + exclude_types: ["dbc", "json"] + exclude: \.token$ + - id: check-yaml + - id: check-added-large-files + +- repo: https://github.com/pycqa/flake8 + rev: '7.0.0' + hooks: + - id: flake8