Enable RET in flake8 and ruff
This commit is contained in:
parent
007998372f
commit
3bd7dd5772
5 changed files with 30 additions and 5 deletions
|
|
@ -203,6 +203,7 @@ def lint_code(session: nox.Session) -> None:
|
|||
"flake8-pyproject",
|
||||
"flake8-pytest-style",
|
||||
"flake8-quotes",
|
||||
"flake8-return",
|
||||
"flake8-sfs",
|
||||
"flake8-simplify",
|
||||
"flake8-todos",
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ dev = [
|
|||
"flake8-pyproject (>=1.2.4,<2.0.0)",
|
||||
"flake8-pytest-style (>=2.2.0,<3.0.0)",
|
||||
"flake8-quotes (>=3.4.0,<4.0.0)",
|
||||
"flake8-return (>=1.2.0,<2.0.0)",
|
||||
"flake8-sfs (>=1.0.1,<2.0.0)",
|
||||
"flake8-simplify (>=0.31.1,<0.32.0)",
|
||||
"flake8-todos (>=0.3.1,<0.4.0)",
|
||||
|
|
@ -222,6 +223,8 @@ select = [
|
|||
"PT0",
|
||||
# flake8-quotes => use double quotes everywhere (complying with black)
|
||||
"Q0",
|
||||
# flake8-return => Consistent return statements
|
||||
"R5",
|
||||
# flake8-sfs => use f-strings as the only type of string formatting
|
||||
"SFS",
|
||||
# flake8-simplify => Simpler code
|
||||
|
|
@ -257,6 +260,10 @@ extend-ignore = [
|
|||
"E203", "W503",
|
||||
# Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`.
|
||||
"PT023",
|
||||
# `ruff`'s RET504 does this better, as it allows statements in between.
|
||||
"R504",
|
||||
# An `elif` after a `return` keeps a case distinction together.
|
||||
"R505",
|
||||
# Allow f-strings as the only type of string formatting.
|
||||
"SFS301",
|
||||
# `bool()` around a comparison can be deliberate (`ruff` omits this rule).
|
||||
|
|
@ -480,6 +487,8 @@ select = [
|
|||
"PT",
|
||||
# flake8-quotes => use double quotes everywhere
|
||||
"Q",
|
||||
# flake8-return ("R5") => Consistent return statements
|
||||
"RET",
|
||||
# flake8-bandit => common security issues
|
||||
"S",
|
||||
# flake8-simplify => Simpler code
|
||||
|
|
@ -512,6 +521,8 @@ extend-ignore = [
|
|||
"PLR2004",
|
||||
# Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`.
|
||||
"PT023",
|
||||
# An `elif` after a `return` keeps a case distinction together.
|
||||
"RET505",
|
||||
# TODOs need neither an author nor an issue.
|
||||
"TD002", "TD003",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -149,10 +149,7 @@ def stl( # noqa:C901,PLR0912,PLR0913,PLR0915
|
|||
|
||||
if no < 0:
|
||||
raise ValueError("`no` must be non-negative")
|
||||
elif no > 0:
|
||||
robust = True
|
||||
else:
|
||||
robust = False
|
||||
robust = no > 0
|
||||
|
||||
# Initialize R only if it is actually used.
|
||||
# For example, the nox session "ci-tests-fast" does not use it.
|
||||
|
|
|
|||
|
|
@ -142,8 +142,10 @@ def make_replay_order(make_order, simulation):
|
|||
if scheduled:
|
||||
if order and order.ad_hoc is False:
|
||||
raise RuntimeError("`order` must be scheduled")
|
||||
elif order is None:
|
||||
|
||||
if order is None:
|
||||
order = make_order(scheduled=True)
|
||||
|
||||
elif order is None:
|
||||
order = make_order()
|
||||
|
||||
|
|
|
|||
14
uv.lock
generated
14
uv.lock
generated
|
|
@ -1039,6 +1039,18 @@ dependencies = [
|
|||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/dd/57/a173e3eb86072b7ee77650aca496b15d6886367d257f58ea9de5276e330a/flake8-quotes-3.4.0.tar.gz", hash = "sha256:aad8492fb710a2d3eabe68c5f86a1428de650c8484127e14c43d0504ba30276c", size = 14107, upload-time = "2024-02-10T21:58:22.357Z" }
|
||||
|
||||
[[package]]
|
||||
name = "flake8-return"
|
||||
version = "1.2.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "flake8-plugin-utils" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/83/49/43ee60c21b61fbec8e86858b2dac7d11a9bdd9958fd7f59077387b6a7197/flake8-return-1.2.0.tar.gz", hash = "sha256:68dfa56582cd704febd02ad86dcf5df67e38e0836d62f1ceae7930d76d3dd955", size = 10033, upload-time = "2022-10-28T09:37:12.507Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f0/8c/6aece77ad2d0d68d8f6e8d5471fd06638de11df656db7d76de810815c437/flake8_return-1.2.0-py3-none-any.whl", hash = "sha256:1f07af12954ed03ebe2c2aac2418f78b55374e9929d4956109664588f31582a1", size = 10121, upload-time = "2022-10-28T09:37:14.468Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flake8-sfs"
|
||||
version = "1.0.1"
|
||||
|
|
@ -3802,6 +3814,7 @@ dev = [
|
|||
{ name = "flake8-pyproject" },
|
||||
{ name = "flake8-pytest-style" },
|
||||
{ name = "flake8-quotes" },
|
||||
{ name = "flake8-return" },
|
||||
{ name = "flake8-sfs" },
|
||||
{ name = "flake8-simplify" },
|
||||
{ name = "flake8-todos" },
|
||||
|
|
@ -3869,6 +3882,7 @@ dev = [
|
|||
{ name = "flake8-pyproject", specifier = ">=1.2.4,<2.0.0" },
|
||||
{ name = "flake8-pytest-style", specifier = ">=2.2.0,<3.0.0" },
|
||||
{ name = "flake8-quotes", specifier = ">=3.4.0,<4.0.0" },
|
||||
{ name = "flake8-return", specifier = ">=1.2.0,<2.0.0" },
|
||||
{ name = "flake8-sfs", specifier = ">=1.0.1,<2.0.0" },
|
||||
{ name = "flake8-simplify", specifier = ">=0.31.1,<0.32.0" },
|
||||
{ name = "flake8-todos", specifier = ">=0.3.1,<0.4.0" },
|
||||
|
|
|
|||
Loading…
Reference in a new issue