fix linting issues

This commit is contained in:
Luke Tainton 2024-04-27 19:06:32 +01:00
parent 527947767e
commit 213315cf93
No known key found for this signature in database
2 changed files with 46 additions and 15 deletions

View File

@ -1,20 +1,48 @@
name: CI name: CI
on: on:
push: workflow_call:
branches: [ main ] secrets:
pull_request: SONAR_TOKEN:
types: [opened, synchronize, reopened] required: true
paths-ignore: SNYK_TOKEN:
- 'README.md' required: true
- 'LICENSE.md'
- '.gitignore'
- 'CODEOWNERS'
- 'renovate.json'
- '.github/'
jobs: jobs:
ci: ci:
uses: luketainton/gha-workflows/.github/workflows/ci-python-poetry.yml@main runs-on: ubuntu-latest
secrets: steps:
- name: Check out repository code
uses: actions/checkout@v4.1.4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: poetry install
- name: Lint
run: poetry run ./tools/lint.sh
- name: Unit Test
run: |
poetry run coverage run -m pytest -v --junitxml=testresults.xml
poetry run coverage xml
sed -i 's@${{ github.workspace }}@/github/workspace@g' coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Snyk Vulnerability Scan
uses: snyk/actions/python-3.10@master
continue-on-error: true # To make sure that SARIF upload gets called
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --sarif-file-output=snyk.sarif
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: snyk.sarif

3
tools/lint.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
pylint --recursive=yes --output-format=parseable --output=lintreport.txt . || pylint-exit $?