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..5d893c155 --- /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", "YTT301"]