From 62831260058cb615187b77a0c62af6a3021610ba Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 22 Oct 2023 13:34:21 +0000 Subject: [PATCH 1/2] Add config for ruff --- .devcontainer/devcontainer.json | 5 ++--- .vscode/extensions.json | 3 ++- .vscode/settings.json | 5 ----- pyproject.toml | 13 +++++++++++++ 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 pyproject.toml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 91c31923f2e..a2028dbb4da 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,13 +22,12 @@ "vscode": { "extensions": [ "guyskk.language-cython", - "ms-python.isort", "ms-toolsai.jupyter", "ms-python.vscode-pylance", - "ms-python.pylint", "ms-python.python", "lextudio.restructuredtext", - "trond-snekvik.simple-rst" + "trond-snekvik.simple-rst", + "charliermarsh.ruff" ] } } diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d0efd087bc9..a304fa28467 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,7 @@ // List of extensions which should be recommended for developers when a workspace is opened for the first time. // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. "recommendations": [ - "ms-python.python" + "ms-python.python", + "charliermarsh.ruff" ], } diff --git a/.vscode/settings.json b/.vscode/settings.json index be90c535c32..ab0f6b8be9e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,11 +23,6 @@ "--doctest-modules" ], "python.testing.unittestEnabled": false, - "python.linting.pycodestyleEnabled": true, - "python.linting.enabled": true, - // The following pycodestyle arguments are the same as the pycodestyle-minimal - // tox environnment, see the file SAGE_ROOT/src/tox.ini - "python.linting.pycodestyleArgs": ["--select= E111,E21,E222,E225,E227,E228,E25,E271,E303,E305,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605"], "cSpell.words": [ "furo", "Conda", diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000000..d5ce3e63cda --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,13 @@ +[tool.ruff] +# Assume Python 3.9 +target-version = "py39" + +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. +] From 259f4296b788ea1afd5855c61dd1a9e9c64dc7aa Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 10 Mar 2024 11:59:22 +0000 Subject: [PATCH 2/2] Put select and ignore in `lint` section to silence deprecation warning --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d5ce3e63cda..1dc0fe88fa9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,7 @@ # Assume Python 3.9 target-version = "py39" +[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