From e37dfbe00af556ed17c5a06f4ae4e291fb1c0bfe Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 25 Mar 2024 16:26:26 -0400 Subject: [PATCH] Use ruff to prevent various regressions --- .github/workflows/main.yml | 3 +++ .pre-commit-config.yaml | 5 +++++ ruff.toml | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 ruff.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f861a1e9a..0c91692da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -107,6 +107,9 @@ jobs: - run: pip install isort pycln - run: pycln . --config=pycln.toml --check - run: isort . --diff --check-only + - uses: chartboost/ruff-action@v1 + with: + version: '0.3.4' - uses: psf/black@stable with: options: "--fast --check --diff --verbose" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 09831791e..5e7c73d92 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,6 +33,11 @@ repos: - id: isort name: isort (python) verbose: true + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.4 + hooks: + - id: ruff # Run the linter. + args: [--fix] - repo: https://github.com/psf/black-pre-commit-mirror rev: 24.2.0 hooks: diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 000000000..c66a82925 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,16 @@ +# Target the oldest supported version +target-version = "py37" + +[lint] +select = [ + "C4", # flake8-comprehensions + "F811", # redefined-while-unused + "FLY", # static-join-to-f-string + "PLE", # Pylint Error + "RSE", # flake8-raise + "YTT", # flake8-2020 +] + +[lint.per-file-ignores] +# TODO: Make adodbapi changes in their own PRs +"adodbapi/*" = ["C4"]