chore(linting): replace wemake-python-styleguide with ruff

This commit is contained in:
Mike 2024-09-01 08:19:37 -07:00
parent b8bcc383a4
commit 5e1a7d2803
3 changed files with 74 additions and 63 deletions

29
poetry.lock generated
View file

@ -2084,6 +2084,33 @@ files = [
{file = "ruamel.yaml.clib-0.2.8.tar.gz", hash = "sha256:beb2e0404003de9a4cab9753a8805a8fe9320ee6673136ed7f04255fe60bb512"},
]
[[package]]
name = "ruff"
version = "0.6.3"
description = "An extremely fast Python linter and code formatter, written in Rust."
optional = false
python-versions = ">=3.7"
files = [
{file = "ruff-0.6.3-py3-none-linux_armv6l.whl", hash = "sha256:97f58fda4e309382ad30ede7f30e2791d70dd29ea17f41970119f55bdb7a45c3"},
{file = "ruff-0.6.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:3b061e49b5cf3a297b4d1c27ac5587954ccb4ff601160d3d6b2f70b1622194dc"},
{file = "ruff-0.6.3-py3-none-macosx_11_0_arm64.whl", hash = "sha256:34e2824a13bb8c668c71c1760a6ac7d795ccbd8d38ff4a0d8471fdb15de910b1"},
{file = "ruff-0.6.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bddfbb8d63c460f4b4128b6a506e7052bad4d6f3ff607ebbb41b0aa19c2770d1"},
{file = "ruff-0.6.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ced3eeb44df75353e08ab3b6a9e113b5f3f996bea48d4f7c027bc528ba87b672"},
{file = "ruff-0.6.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:47021dff5445d549be954eb275156dfd7c37222acc1e8014311badcb9b4ec8c1"},
{file = "ruff-0.6.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:7d7bd20dc07cebd68cc8bc7b3f5ada6d637f42d947c85264f94b0d1cd9d87384"},
{file = "ruff-0.6.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:500f166d03fc6d0e61c8e40a3ff853fa8a43d938f5d14c183c612df1b0d6c58a"},
{file = "ruff-0.6.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:42844ff678f9b976366b262fa2d1d1a3fe76f6e145bd92c84e27d172e3c34500"},
{file = "ruff-0.6.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70452a10eb2d66549de8e75f89ae82462159855e983ddff91bc0bce6511d0470"},
{file = "ruff-0.6.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:65a533235ed55f767d1fc62193a21cbf9e3329cf26d427b800fdeacfb77d296f"},
{file = "ruff-0.6.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d2e2c23cef30dc3cbe9cc5d04f2899e7f5e478c40d2e0a633513ad081f7361b5"},
{file = "ruff-0.6.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8a136aa7d228975a6aee3dd8bea9b28e2b43e9444aa678fb62aeb1956ff2351"},
{file = "ruff-0.6.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:f92fe93bc72e262b7b3f2bba9879897e2d58a989b4714ba6a5a7273e842ad2f8"},
{file = "ruff-0.6.3-py3-none-win32.whl", hash = "sha256:7a62d3b5b0d7f9143d94893f8ba43aa5a5c51a0ffc4a401aa97a81ed76930521"},
{file = "ruff-0.6.3-py3-none-win_amd64.whl", hash = "sha256:746af39356fee2b89aada06c7376e1aa274a23493d7016059c3a72e3b296befb"},
{file = "ruff-0.6.3-py3-none-win_arm64.whl", hash = "sha256:14a9528a8b70ccc7a847637c29e56fd1f9183a9db743bbc5b8e0c4ad60592a82"},
{file = "ruff-0.6.3.tar.gz", hash = "sha256:183b99e9edd1ef63be34a3b51fee0a9f4ab95add123dbf89a71f7b1f0c991983"},
]
[[package]]
name = "safety"
version = "3.2.5"
@ -2595,4 +2622,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools",
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
content-hash = "92f7135e0c79f2999aa96d7f939c6a61da6f2f541d2c76b109f49f624da6fdd7"
content-hash = "6d9faa337e885dd91eb19f65ad1334464f49438060562db96df1ccdc151c2d1e"

View file

@ -75,11 +75,7 @@ django = ">=4.2,<5.2"
[tool.poetry.group.test.dependencies]
mypy = "^1.6"
wemake-python-styleguide = "^0.17"
flake8-pytest-style = "^1.7"
nitpick = ">=0.34,<0.36"
black = ">=22.12,<25.0"
ruff = "^0.6.3"
safety = ">=2.3,<4.0"
@ -100,3 +96,48 @@ sphinx-rtd-theme = ">=1.3,<3.0"
sphinx-autodoc-typehints = ">=1.19.5,<3.0.0"
m2r2 = "^0.3"
tomlkit = ">=0.13.0,<0.14"
[tool.ruff]
line-length = 88
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN", # Type hints related, let mypy handle these.
"ARG", # Unused arguments
"D", # Docstrings related
"EM101", # "Exception must not use a string literal, assign to variable first"
"EM102", # "Exception must not use an f-string literal, assign to variable first"
"PD", # Pandas related
"Q000", # For now
"SIM105", # "Use contextlib.suppress({exception}) instead of try-except-pass"
"TRY003", # "Avoid specifying long messages outside the exception class"
]
[tool.ruff.lint.flake8-implicit-str-concat]
allow-multiline = false
[tool.ruff.lint.per-file-ignores]
# Allow private member access for Registry
"eav/registry.py" = ["SLF001"]
# Migrations are special
"**/migrations/*" = ["RUF012"]
# Sphinx specific
"docs/source/conf.py" = ["INP001"]
# pytest is even more special
"tests/*" = [
"INP001", # "Add an __init__.py"
"PLR2004", # "Magic value used in comparison"
"PT009", # "Use a regular assert instead of unittest-style"
"PT027", # "Use pytest.raises instead of unittest-style"
"S101", # "Use of assert detected"
"SLF001" # "Private member accessed"
]
[tool.ruff.lint.pydocstyle]
# Use Google-style docstrings.
convention = "google"

View file

@ -3,63 +3,6 @@
# https://docs.python.org/3/distutils/configfile.html
[flake8]
format = wemake
show-source = True
doctests = False
statistics = False
# darglint configuration:
# https://github.com/terrencepreilly/darglint
strictness = long
docstring-style = numpy
# Plugins:
max-complexity = 6
max-line-length = 80
exclude =
# Trash and cache:
.git
__pycache__
.venv
.eggs
*.egg
temp
ignore =
D100,
D104,
D401,
W504,
X100,
RST303,
RST304,
DAR103,
DAR203
per-file-ignores =
# Allow to have magic numbers inside migrations, wrong module names,
# and string over-use:
*/migrations/*.py: WPS102, WPS114, WPS226, WPS432
# Allow `__init__.py` with logic for configuration:
test_project/settings.py: S105, WPS226, WPS407
tests/test_*.py: N806, S101, S404, S603, S607, WPS118, WPS226, WPS432, WPS442
[isort]
# isort configuration:
# https://github.com/timothycrosley/isort/wiki/isort-Settings
include_trailing_comma = true
use_parentheses = true
# See https://github.com/timothycrosley/isort#multi-line-output-modes
multi_line_output = 3
line_length = 80
# Useful for our test app:
known_first_party = test_project
[tool:pytest]
# Django options:
# https://pytest-django.readthedocs.io/en/latest/