From a37eea56a149fd057bfc810d185381ec81d9cee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Tue, 8 Jul 2025 01:47:33 +0200 Subject: [PATCH] Use Ruff --- pyproject.toml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 29a2106..bcb2e95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,3 +12,47 @@ dev = ["pytest>=8.4.1", "pytest-django>=4.11.1"] [tool.pytest.ini_options] DJANGO_SETTINGS_MODULE = "config.settings" python_files = ["test_*.py", "*_test.py"] + + +[tool.ruff] +lint.select = ["ALL"] +preview = true +unsafe-fixes = true +fix = true + +# Don't automatically remove unused variables +lint.unfixable = ["F841"] + +lint.pydocstyle.convention = "google" +lint.isort.required-imports = ["from __future__ import annotations"] +line-length = 140 + +lint.ignore = [ + "CPY001", # Checks for the absence of copyright notices within Python files. + "D100", # Checks for undocumented public module definitions. + "D104", # Checks for undocumented public package definitions. + "D106", # Checks for undocumented public class definitions, for nested classes. + "ERA001", # Checks for commented-out Python code. + "FIX002", # Checks for "TODO" comments. + + # Conflicting lint rules when using Ruff's formatter + # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules + "COM812", # Checks for the absence of trailing commas. + "COM819", # Checks for the presence of prohibited trailing commas. + "D206", # Checks for docstrings that are indented with tabs. + "D300", # Checks for docstrings that use '''triple single quotes''' instead of """triple double quotes""". + "E111", # Checks for indentation with a non-multiple of 4 spaces. + "E114", # Checks for indentation of comments with a non-multiple of 4 spaces. + "E117", # Checks for over-indented code. + "ISC001", # Checks for implicitly concatenated strings on a single line. + "ISC002", # Checks for implicitly concatenated strings that span multiple lines. + "Q000", # Checks for inline strings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.inline-quotes option. + "Q001", # Checks for multiline strings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.multiline-quotes setting. + "Q002", # Checks for docstrings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.docstring-quotes setting. + "Q003", # Checks for strings that include escaped quotes, and suggests changing the quote style to avoid the need to escape them. + "W191", # Checks for indentation that uses tabs. +] + +[tool.ruff.lint.per-file-ignores] +"**/tests/**" = ["ARG", "FBT", "PLR2004", "S101", "S311"] +"**/migrations/**" = ["RUF012"]