From 7b23efdd36e6a1cdcf4e876caebce621565b8db2 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Mon, 14 Aug 2023 22:20:51 +0200 Subject: [PATCH] Enable more ruff lints --- .pre-commit-config.yaml | 2 +- docs/conf.py | 1 + pyproject.toml | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9a4e0407..7d032e09e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: - id: check-added-large-files - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.270 + rev: v0.0.284 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/docs/conf.py b/docs/conf.py index 50d8d0ae4..372ff5e94 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,4 @@ +# noqa: INP001 # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full diff --git a/pyproject.toml b/pyproject.toml index ad1b483f1..27f0b4d90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,47 @@ [tool.ruff] select = [ - "E", "F", + "E", "W", - "B", "I", + # "N", # TODO: fixing these would break public API "UP", + "YTT", + # "ANN", + # "BLE", + # "FBT", + "B", + # "A", # Conflicts with some django patterns "C4", + "ISC", + "ICN", + "G", + "INP", + "PIE", + "PYI", + # "PT", # TODO: some tests are not pytest + "Q", + "RSE", + "RET", + # "SIM", # TODO + "TID", + "TCH", + "INT", + "ERA", + "PGH", + "PLE", + "RUF", ] target-version = "py38" +ignore = [ + "RUF012", # FIXME +] [tool.ruff.isort] force-single-line = true + +[tool.ruff.per-file-ignores] +# Fails with auto-generated migrations. Unsolvable contradiction between ruff and mypy. +# This likely needs to be addressed in Django itself (either use an immutable +# type or annotate these fields as ClassVar) +"testapp/testapp/testmain/migrations/0*.py"= ["RUF012"]