From d639fa44439a8e38049e056cf98f78863c539b6c Mon Sep 17 00:00:00 2001 From: rdbende Date: Sat, 20 Jan 2024 18:05:09 +0100 Subject: [PATCH] Replace flake8 checks with Ruff, and make it fail on error --- .github/workflows/build.yml | 24 ------------------------ .github/workflows/checks.yml | 16 ++++++++++++++++ .github/workflows/tests.yml | 18 ++++++++++++++++++ pyproject.toml | 6 +++++- 4 files changed, 39 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/checks.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 40af8faa..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Unit Testing - -on: [push, pull_request] - -jobs: - test: - - runs-on: ubuntu-latest - container: - image: ghcr.io/geigi/cozy-ci:main - - steps: - - uses: actions/checkout@v4 - - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --builtins="_" - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --builtins="_" - - - name: Test with pytest - run: | - pytest diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 00000000..a7c4f284 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,16 @@ +name: Checks + +on: + push: + branches: + - "main" + pull_request: + +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chartboost/ruff-action@v1 + with: + args: --output-format github \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..9f7d14b4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,18 @@ +name: Tests + +on: + push: + branches: + - "main" + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + container: + image: ghcr.io/geigi/cozy-ci:main + + steps: + - uses: actions/checkout@v4 + run: | + pytest diff --git a/pyproject.toml b/pyproject.toml index cd6386ac..a019a68d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,4 +5,8 @@ skip-magic-trailing-comma = true [tool.isort] line_length = 100 profile = "black" -multi_line_output = 3 \ No newline at end of file +multi_line_output = 3 + +[tool.ruff] +line-length = 100 +builtins = ["_"] \ No newline at end of file