Skip to content

Commit

Permalink
Include more ruff ignores for all test files (#470)
Browse files Browse the repository at this point in the history
Co-authored-by: always-on-duty[bot] <120557446+always-on-duty[bot]@users.noreply.github.com>
  • Loading branch information
FasterSpeeding and always-on-duty[bot] authored Dec 2, 2024
1 parent ec7fdf7 commit b7703b8
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 82 deletions.
160 changes: 79 additions & 81 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,87 +102,6 @@ exclude_lines = [
"^if typing.TYPE_CHECKING:$"
]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in ``
"COM812", # Trailing comma missing (incompatible with black)
"FIX002", # Line contains TODO, consider resolving the issue
"I001", # [*] Import block is un-sorted or un-formatted
"S101", # Use of `assert` detected
"SIM108", # Use ternary operator `` instead of `if`-`else`-block
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
"TD003", # Missing issue link on the line following this TODO
]

[tool.ruff.lint.per-file-ignores]
"docs_src/**/*.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"F841", # Local variable `` is assigned to but never used
"INP001", # File `` is part of an implicit namespace package. Add an `__init__.py`.
"PIE790", # [*] Unnecessary `...` literal
"T201", # `print` found
]
"noxfile.py" = [
"F403", # `from noxfile import *` used; unable to detect undefined name
]
"tests/**/*.py" = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"PLR2004", # Magic value used in comparison, consider replacing `` with a constant variable
"SLF001", # Private member accessed: `_injector`
]
"tests/test__client.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
]
"tests/test_async_callback_di_future_annotations.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"FBT001", # Boolean-typed positional argument in function definition
"PGH003", # Use specific rule codes when ignoring type issues
"PLW0603", # Using the global statement to update `` is discouraged
"UP007", # [*] Use `X | Y` for type annotations
]
"tests/test_async_callback_di.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"FBT001", # Boolean-typed positional argument in function definition
"PGH003", # Use specific rule codes when ignoring type issues
"UP007", # [*] Use `X | Y` for type annotations
]
"tests/test_callback_di_future_annotations.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"FBT001", # Boolean-typed positional argument in function definition
"PGH003", # Use specific rule codes when ignoring type issues
"PLW0603", # Using the global statement to update `` is discouraged
"UP007", # [*] Use `X | Y` for type annotations
]
"tests/test_callback_di.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"FBT001", # Boolean-typed positional argument in function definition
"PGH003", # Use specific rule codes when ignoring type issues
"UP007", # [*] Use `X | Y` for type annotations
]

[tool.ruff.lint.mccabe]
max-complexity = 20

[tool.ruff.lint.pycodestyle]
# Technically this is 120, but black has a policy of "1 or 2 over is fine if it is tidier", so we have to raise this.
max-line-length = 130

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.lint.pylint]
max-args = 12
max-branches = 15

[tool.isort]
profile = "black"
force_single_line = true
Expand Down Expand Up @@ -271,7 +190,86 @@ filterwarnings = [
"ignore:Use ContextOverride:DeprecationWarning",
]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in ``
"COM812", # Trailing comma missing (incompatible with black)
"FIX002", # Line contains TODO, consider resolving the issue
"I001", # [*] Import block is un-sorted or un-formatted
"S101", # Use of `assert` detected
"SIM108", # Use ternary operator `` instead of `if`-`else`-block
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
"TD003", # Missing issue link on the line following this TODO
]

[tool.ruff.lint.per-file-ignores]
"docs_src/**/*.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"F841", # Local variable `` is assigned to but never used
"INP001", # File `` is part of an implicit namespace package. Add an `__init__.py`.
"PIE790", # [*] Unnecessary `...` literal
"T201", # `print` found
]
"noxfile.py" = [
"F403", # `from noxfile import *` used; unable to detect undefined name
]
"tests/**/*.py" = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"FBT001", # Boolean-typed positional argument in function definition
"PGH003", # Use specific rule codes when ignoring type issues
"PLR2004", # Magic value used in comparison, consider replacing `` with a constant variable
"SLF001", # Private member accessed: ``
]
"tests/test__client.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
]
"tests/test_async_callback_di_future_annotations.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"PLW0603", # Using the global statement to update `` is discouraged
"UP007", # [*] Use `X | Y` for type annotations
]
"tests/test_async_callback_di.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"UP007", # [*] Use `X | Y` for type annotations
]
"tests/test_callback_di_future_annotations.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"PLW0603", # Using the global statement to update `` is discouraged
"UP007", # [*] Use `X | Y` for type annotations
]
"tests/test_callback_di.py" = [
"B008", # Do not perform function call `` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
"UP007", # [*] Use `X | Y` for type annotations
]

[tool.ruff.lint.mccabe]
max-complexity = 20

[tool.ruff.lint.pycodestyle]
# Technically this is 120, but black has a policy of "1 or 2 over is fine if it is tidier", so we have to raise this.
max-line-length = 130

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.lint.pylint]
max-args = 12
max-branches = 15
max-returns = 10

[tool.slotscheck]
strict-imports = true
require-superclass = true
require-subclass = true

[tool.uv]
reinstall-package = ["alluka"]
2 changes: 1 addition & 1 deletion tests/test__client.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_inject_when_callback() -> None:

def test_inject_when_both_callback_and_type() -> None:
with pytest.raises(ValueError, match="Only one of `callback` or `type` can be specified"):
alluka.inject(type=mock.Mock(), callback=mock.Mock()) # type: ignore # noqa: PGH003
alluka.inject(type=mock.Mock(), callback=mock.Mock()) # type: ignore


class TestClient:
Expand Down

0 comments on commit b7703b8

Please sign in to comment.