Skip to content

Commit

Permalink
DEV: Tidy ignore array in tool.ruff.lint (py-pdf#3069)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-t-1 authored Jan 23, 2025
1 parent f1b471b commit eec079d
Showing 1 changed file with 85 additions and 69 deletions.
154 changes: 85 additions & 69 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,78 +118,94 @@ line-length = 120
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"D404", # First word of the docstring should not be "This"
# I would like to have it, but there are a few annoying exceptions:
"D401", # First line of docstring should be in imperative mood - false positives
"ERA001",
"UP031",
"D205", # 1 blank line required between summary line and description
"D400", # First line should end with a period
"D415", # First line should end with a period
# Introduces bugs
"RUF001", "RUF002", "RUF005",
"ARG",
"DTZ001", # The use of `datetime.datetime()` without `tzinfo` is necessary
"PLC",
# Personal preference
"PLR1714", # Consider merging multiple comparisons
"FA100", # Missing `from __future__ import annotations`, but uses `typing.Dict`
"TD002", # Authors of TODOs can be found via git
"FIX002", # TODOs should typically not be in the code, but sometimes are ok
"D406", # Section name should end with a newline ("Returns")
"D212", # I want multiline-docstrings to start at the second line
"D407", # google-style docstrings don't have dashses
"N806", # Variable `NO` in function should be lowercase
"N814", # Camelcase `PageAttributes` imported as constant `PG`
"N817", # CamelCase `PagesAttributes` imported as acronym `PA`
"ANN204", # Missing return type annotation for special method `__init__`
"A", # Variable is shadowing a built-in
"ANN204", # Missing return type annotation for special method `__init__`
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"BLE", # we want to capture Exception sometimes
"COM812", # yes, they make the diff smaller
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__`
"D203", # one-blank-line-before-class
"EM", # exception messages
"G004", # f-string in logging statement
"RET",
"S110", # `try`-`except`-`pass` detected, consider logging the exception
"ARG001", # Unused function argument
"ARG002", # Unused method argument
"ARG003", # Unused class method argument
"ARG004", # Unused static method argument
"ARG005", # Unused lambda argument
"B028", # No explicit `stacklevel` keyword argument found
"B904", # Within an `except` clause, raise exceptions with
"B905", # `zip()` without an explicit `strict=` parameter
"BLE001", # Do not catch blind exception: `Exception`
"COM812", # Yes, they make the diff smaller
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__`
"D203", # one-blank-line-before-class
"D205", # One blank line required between summary line and description
"D212", # I want multiline-docstrings to start at the second line
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood - false positives
"D404", # First word of the docstring should not be "This"
"D406", # Section name should end with a newline ("Returns")
"D407", # Google-style docstrings don't have dashses
"D415", # First line should end with a period
"D417", # Missing argument descriptions in the docstring
"DTZ001", # The use of `datetime.datetime()` without `tzinfo` is necessary
"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
"ERA001", # Found commented-out code
"FA100", # Missing `from __future__ import annotations`, but uses `typing.Dict`
"FA102", # Missing `from __future__ import annotations`, but uses PEP 604 union
"FBT001", # Boolean positional arg in function definition
"FBT002", # Boolean default value in function definition
"FBT003", # Boolean positional value in function call
"FIX002", # TODOs should typically not be in the code, but sometimes are ok
"G004", # f-string in logging statement
"N806", # non-lowercase-variable-in-function
"N814", # Camelcase `PageAttributes` imported as constant `PG`
"N817", # CamelCase `PagesAttributes` imported as acronym `PA`
"PERF203", # `try`-`except` within a loop incurs performance overhead
"PGH003", # Use specific rule codes when ignoring type issues
"PGH004", # Use specific rule codes when using `noqa`
"PLC0206", # Extracting value from dictionary without calling `.items()`
"PLR1714", # Consider merging multiple comparisons
"PLW0602", # Using global for `CUSTOM_RTL_SPECIAL_CHARS` but no assignment is done
"PLW0603", # Using the global statement to update `CUSTOM_RTL_SPECIAL_CHARS` is discouraged
"PLW1510", # `subprocess.run` without explicit `check` argument
"PLW2901", # `with` statement variable `img` overwritten by assignment target
"PLW3301", # Nested `min` calls can be flattened
"PT011", # `pytest.raises(ValueError)` is too broad, set the `match`
"PT012", # `pytest.raises()` block should contain a single simple statement
"PT014", # Ruff bug: Duplicate of test case at index 1 in `@pytest_mark.parametrize`
"PTH123", # `open()` should be replaced by `Path.open()`
"PYI042", # Type alias `mode_str_type` should be CamelCase
"RET501", # Do not explicitly `return None` in function if it is the only possible return value
"RET502", # Do not implicitly `return None` in function able to return non-`None` value
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
"RET504", # Unnecessary assignment to `changelog` before `return`
"RET505", # Unnecessary `else` after `return` statement
"RET506", # Unnecessary `else` after `raise` statement
"RET507", # Unnecessary `else` after `continue` statement
"RET508", # Unnecessary `else` after `break` statement
"RUF001", # Detect confusable Unicode-to-Unicode units. Introduces bugs
"RUF002", # Detect confusable Unicode-to-Unicode units. Introduces bugs
"RUF005", # Detect confusable Unicode-to-Unicode units. Introduces bugs
"S101", # Use of `assert` detected
"S110", # `try`-`except`-`pass` detected, consider logging the exception
"SIM105", # contextlib.suppress
"SIM108", # don't enforce ternary operators
"TID252", # we want relative imports
"TRY", # I don't know what this is about
# As long as we are not on Python 3.9+
"UP035", # PEP 585
# As long as we are not on Python 3.10+
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` - PEP 604
# As long as we are not on Python 3.11+
"UP006", "UP007",
# for the moment, fix it later:
"TD003", # Missing issue link on the line following this TODO
"TD005", # Missing issue description after `TODO`
"A", # Variable is shadowing a built-in
"B028", # No explicit `stacklevel` keyword argument found
"B904", # Within an `except` clause, raise exceptions with
"B905", # `zip()` without an explicit `strict=` parameter
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D417", # Missing argument descriptions in the docstring
"FBT001", # Boolean positional arg in function definition
"FBT002", # Boolean default value in function definition
"FBT003", # Boolean positional value in function call
"PGH", # Use specific error messages
"PLE", # too many arguments for logging
"PLW", # global variables
"PT011", # `pytest.raises(ValueError)` is too broad, set the `match`
"PT012", # `pytest.raises()` block should contain a single simple statement
"PTH123", # `open()` should be replaced by `Path.open()`
"S101", # Use of `assert` detected
"SIM108", # Don't enforce ternary operators
"SLF001", # Private member accessed
"FA102", # Missing `from __future__ import annotations`, but uses PEP 604 union
"PERF203", # `try`-`except` within a loop incurs performance overhead
"PYI042", # Type alias `mode_str_type` should be CamelCase
# Ruff bug
"PT014", # Duplicate of test case at index 1 in `@pytest_mark.parametrize`
"TD002", # Authors of TODOs can be found via git
"TD003", # For the moment, fix it later: Missing issue link on the line following this TODO
"TD005", # Missing issue description after `TODO`
"TID252", # We want relative imports
"TRY002", # Create your own exception
"TRY003", # Avoid specifying long messages outside the exception class
"TRY004", # Prefer `TypeError` exception for invalid type
"TRY201", # Use `raise` without specifying exception name
"TRY300", # Consider moving this statement to an `else` block
"TRY301", # Abstract `raise` to an inner function
"UP006", # Non-PEP 585 annotation. As long as we are not on Python 3.11+
"UP007", # Non-PEP 604 annotation. As long as we are not on Python 3.11+
"UP031", # Use format specifiers instead of percent format
"UP035", # PEP 585. As long as we are not on Python 3.9+
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` - PEP 604. While not on Python 3.10+
]

[tool.ruff.lint.mccabe]
Expand Down

0 comments on commit eec079d

Please sign in to comment.