diff --git a/.vscode/settings.json b/.vscode/settings.json index 8998f229f9f..073791ff4ef 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -107,7 +107,9 @@ "zmax", "zmin" ], - "editor.formatOnType": true, + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff" + }, "esbonio.sphinx.confDir": "", // Don't update the settings.json file with values inferred from Meson (we provide them manually) "mesonbuild.modifySettings": false, diff --git a/pyproject.toml b/pyproject.toml index 3685d5d3bf4..198b1fe5572 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -175,3 +175,25 @@ lint = [ "pycodestyle", "flake8-rst-docstrings", ] + +[tool.ruff] +# https://docs.astral.sh/ruff/configuration + +# Python 3.11 is the minimum supported version +target-version = "py311" + +[tool.ruff.lint] +select = [ + "E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e + "F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f + "I", # isort - https://docs.astral.sh/ruff/rules/#isort-i + "PL", # pylint - https://docs.astral.sh/ruff/rules/#pylint-pl +] +ignore = [ + "E501", # Line too long - hard to avoid in doctests, and better handled by black. +] + +[tool.ruff.lint.per-file-ignores] +"all.py" = [ + "F401", # Unused import - these files are by definition collections of imports. +] diff --git a/ruff.toml b/ruff.toml deleted file mode 100644 index 1c21d484455..00000000000 --- a/ruff.toml +++ /dev/null @@ -1,19 +0,0 @@ -# https://docs.astral.sh/ruff/configuration/#config-file-discovery - -# Python 3.11 is the minimum supported version -target-version = "py311" - -lint.select = [ - "E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e - "F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f - "I", # isort - https://docs.astral.sh/ruff/rules/#isort-i - "PL", # pylint - https://docs.astral.sh/ruff/rules/#pylint-pl -] -lint.ignore = [ - "E501", # Line too long - hard to avoid in doctests, and better handled by black. -] - -[lint.per-file-ignores] -"all.py" = [ - "F401", # Unused import - these files are by definition collections of imports. -]