Enable more lint rules #10

Merged
alexander merged 31 commits from more-lint-rules into develop 2026-11-30 23:59:09 +01:00
2 changed files with 10 additions and 4 deletions
Showing only changes of commit d0326aee4f - Show all commits

Enable SLF in ruff

Alexander Hess 2026-11-30 22:35:24 +01:00
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -557,7 +557,7 @@ def do_not_accept_arguments(session: nox.Session, *, raise_error: bool = True) -
def do_not_reuse(session: nox.Session, *, raise_error: bool = True) -> None:
"""Do not reuse a session with the "-r" or "-R" flags."""
if session._runner.venv._reused:
if session._runner.venv._reused: # noqa:SLF001
msg = 'be run without the "-r" and "-R" flags'
if raise_error:
@ -645,8 +645,9 @@ def skip_install(session: nox.Session) -> bool:
"""
# Same logic to skip package installation as in core `nox`
# See: https://github.com/wntrblm/nox/blob/2026.10.20/nox/sessions.py#L905
venv = session._runner.venv
return bool(session._runner.global_config.no_install and venv._reused)
no_install = session._runner.global_config.no_install # noqa:SLF001
venv_reused = session._runner.venv._reused # noqa:SLF001
return bool(no_install and venv_reused)
if MAIN_PYTHON not in SUPPORTED_PYTHONS:

View file

@ -257,6 +257,8 @@ select = [
# "PL",
# flake8-use-pathlib => `pathlib` instead of `os` functions
# "PTH",
# flake8-self => No access to private members from outside
# "SLF",
# pyupgrade => Modern syntax for the targeted Python version
# "UP",
]
@ -541,6 +543,8 @@ select = [
"PL",
# flake8-use-pathlib => `pathlib` instead of `os` functions
"PTH",
# flake8-self => No access to private members from outside
"SLF",
# flake8-print => no `print()`
"T20",
# pyupgrade => Modern syntax for the targeted Python version
@ -579,7 +583,8 @@ extend-ignore = [
# - PLR0913, PLR0917 => `pytest` passes fixtures as arguments.
# - S101 => `assert` statements are ok in the test suite.
# - S311 => The `random` module is not used for cryptography.
"tests/**/*.py" = ["ANN0", "ANN2", "D106", "PLR0913", "PLR0917", "S101", "S311"]
# - SLF001 => Tests may set up and inspect private members.
"tests/**/*.py" = ["ANN0", "ANN2", "D106", "PLR0913", "PLR0917", "S101", "S311", "SLF001"]
[tool.ruff.lint.flake8-pytest-style] # aligned with [tool.flake8] above