From d639fa44439a8e38049e056cf98f78863c539b6c Mon Sep 17 00:00:00 2001 From: rdbende Date: Sat, 20 Jan 2024 18:05:09 +0100 Subject: [PATCH 1/4] 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 From 782f0b9969d38fb547cf15ac8dec2abd9575f1bc Mon Sep 17 00:00:00 2001 From: rdbende Date: Sat, 20 Jan 2024 18:37:37 +0100 Subject: [PATCH 2/4] Select some useful checks --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a019a68d..88a50fdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,4 +9,6 @@ multi_line_output = 3 [tool.ruff] line-length = 100 -builtins = ["_"] \ No newline at end of file +builtins = ["_"] +output-format = "github" +extend-select = ["B", "SIM", "PIE", "C4", "GT", "LOG"] From 5fbd483b26aa41ff8c43a7b5e948e3e89acfbf54 Mon Sep 17 00:00:00 2001 From: rdbende Date: Sat, 20 Jan 2024 18:37:55 +0100 Subject: [PATCH 3/4] Don't make the check fails for now --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index a7c4f284..d9d9b846 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -13,4 +13,4 @@ jobs: - uses: actions/checkout@v4 - uses: chartboost/ruff-action@v1 with: - args: --output-format github \ No newline at end of file + args: --exit-zero \ No newline at end of file From aab9d1fca533cf7f2bd94d749c654d98560eda22 Mon Sep 17 00:00:00 2001 From: rdbende Date: Sat, 20 Jan 2024 18:43:14 +0100 Subject: [PATCH 4/4] It's INT in Ruff --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 88a50fdb..10591275 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,4 +11,4 @@ multi_line_output = 3 line-length = 100 builtins = ["_"] output-format = "github" -extend-select = ["B", "SIM", "PIE", "C4", "GT", "LOG"] +extend-select = ["B", "SIM", "PIE", "C4", "INT", "LOG"]