Make linters check for unused function arguments
This commit is contained in:
parent
25c718fe6a
commit
81912f1a81
5 changed files with 27 additions and 3 deletions
|
@ -208,6 +208,7 @@ def lint(session: nox.Session) -> None:
|
|||
"flake8-todos",
|
||||
"flake8-pyproject",
|
||||
"flake8-pytest-style",
|
||||
"flake8-unused-arguments",
|
||||
"mypy",
|
||||
"pep8-naming", # flake8 plug-in
|
||||
"pydoclint[flake8]",
|
||||
|
|
16
poetry.lock
generated
16
poetry.lock
generated
|
@ -722,6 +722,20 @@ pycodestyle = "*"
|
|||
[package.extras]
|
||||
dev = ["isort[pyproject]", "pytest"]
|
||||
|
||||
[[package]]
|
||||
name = "flake8-unused-arguments"
|
||||
version = "0.0.13"
|
||||
description = "flake8 extension to warn on unused function arguments"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "flake8-unused-arguments-0.0.13.tar.gz", hash = "sha256:c5894d294424bf7915e44dff0917222c454151016f96edc55b9f847bf307f3f7"},
|
||||
{file = "flake8_unused_arguments-0.0.13-py3-none-any.whl", hash = "sha256:df6a76b73a6ce67720332182a80f2f0a80783cab1ccae8175f39787cd3a74b31"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
flake8 = ">3.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "identify"
|
||||
version = "2.6.1"
|
||||
|
@ -1728,4 +1742,4 @@ type = ["pytest-mypy"]
|
|||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.9"
|
||||
content-hash = "a10f3c13ed0c67e6ea65500335281cd269e3efdd0fae544ad667d07637ef118f"
|
||||
content-hash = "e0962e284e415b91fad954a9ca20d3dd45be434d23c63ce1e38da75f69e9557c"
|
||||
|
|
|
@ -61,6 +61,7 @@ flake8-string-format = "^0.3"
|
|||
flake8-todos = "^0.3"
|
||||
flake8-pyproject = "^1.2"
|
||||
flake8-pytest-style = "^2.0"
|
||||
flake8-unused-arguments = "^0.0"
|
||||
mypy = "^1.11"
|
||||
pep8-naming = "^0.14" # flake8 plug-in
|
||||
pydoclint = { extras = ["flake8"], version = "^0.5" }
|
||||
|
@ -177,6 +178,7 @@ select = [
|
|||
"S", # flake8-bandit => common security issues
|
||||
"T00", # flake8-todos => unify TODOs
|
||||
"T10", # flake8-debugger => no debugger usage
|
||||
"U100", # flake8-unused-arguments => declared function arguments must be used
|
||||
|
||||
# violations not covered by `ruff` below
|
||||
|
||||
|
@ -255,6 +257,12 @@ docstring-quotes = "double"
|
|||
inline-quotes = "double"
|
||||
multiline-quotes = "double"
|
||||
|
||||
# Plug-in: flake8-unused-arguments
|
||||
# Source: https://github.com/nhoad/flake8-unused-arguments
|
||||
# Make flake8-unused-arguments behave like ruff's "ARG" error code
|
||||
unused-arguments-ignore-abstract-functions = true
|
||||
unused-arguments-ignore-stub-functions = true
|
||||
|
||||
|
||||
|
||||
[tool.isort] # aligned with [tool.ruff.lint.isort] below
|
||||
|
@ -347,6 +355,7 @@ select = [
|
|||
# violations also covered by `flake8` above
|
||||
|
||||
"ANN", # flake8-annotations => enforce type checking for functions
|
||||
"ARG", # flake8-unused-arguments => declared function arguments must be used
|
||||
"B", # flake8-bugbear => bugs and design flaws
|
||||
"C4", # flake8-comprehensions => better comprehensions
|
||||
"C90", # mccabe => cyclomatic complexity
|
||||
|
|
|
@ -109,7 +109,7 @@ def _to_gf2(
|
|||
class GF2Meta(abc.ABCMeta):
|
||||
"""Make data type of `one` and `zero` appear to be `gf2`."""
|
||||
|
||||
def __repr__(cls) -> str:
|
||||
def __repr__(cls) -> str: # noqa: RUF100,U100
|
||||
"""Text representation for `GF2Element` and sub-classes."""
|
||||
return "gf2"
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class Field(abc.ABC, Generic[T]):
|
|||
return self._dtype(value, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
def _post_cast_filter(possible_element: T, /) -> bool:
|
||||
def _post_cast_filter(possible_element: T, /) -> bool: # noqa: ARG004
|
||||
"""Function to filter out castable `value`s.
|
||||
|
||||
Called after a successfull call of the `._cast_func()`.
|
||||
|
|
Loading…
Reference in a new issue