Skip to content

Commit b6e656b

Browse files
committed
Enable some additional ruff lint check rules and enable auto-fix of lint rules on "make check"
1 parent 7420eda commit b6e656b

File tree

2 files changed

+66
-68
lines changed

2 files changed

+66
-68
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: ruff-format
1414
args: [--config=pyproject.toml]
1515
- id: ruff-check
16-
args: [--config=pyproject.toml]
16+
args: [--config=pyproject.toml, --fix]
1717

1818
- repo: https://github.com/pre-commit/mirrors-prettier
1919
rev: "v3.1.0"

pyproject.toml

Lines changed: 65 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -155,75 +155,73 @@ output-format = "full"
155155
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
156156
# McCabe complexity (`C901`) by default.
157157
select = [
158-
# https://beta.ruff.rs/docs/rules
159-
# "A", # flake8-builtins
160-
# "ANN", # flake8-annotations
161-
# "ARG", # flake8-unused-arguments
162-
"ASYNC", # flake8-async
163-
# "B", # flake8-bugbear
164-
# "BLE", # flake8-blind-except
165-
# "C4", # flake8-comprehensions
166-
"C90", # McCabe cyclomatic complexity
167-
# "COM", # flake8-commas
168-
# "D", # pydocstyle
169-
"DJ", # flake8-django
170-
# "DTZ", # flake8-datetimez
171-
"E", # pycodestyle
172-
# "EM", # flake8-errmsg
173-
# "ERA", # eradicate
174-
# "EXE", # flake8-executable
175-
"F", # Pyflakes
176-
"FA", # flake8-future-annotations
177-
# "FBT", # flake8-boolean-trap
178-
"G", # flake8-logging-format
179-
# "I", # isort
180-
"ICN", # flake8-import-conventions
181-
# "INP", # flake8-no-pep420
182-
"INT", # flake8-gettext
183-
# "ISC", # flake8-implicit-str-concat
184-
# "N", # pep8-naming
185-
"NPY", # NumPy-specific rules
186-
"PD", # pandas-vet
187-
# "PGH", # pygrep-hooks
188-
# "PIE", # flake8-pie
189-
# "PL", # Pylint
190-
# "PT", # flake8-pytest-style
191-
# "PTH", # flake8-use-pathlib
192-
# "PYI", # flake8-pyi
193-
# "RET", # flake8-return
194-
"RSE", # flake8-raise
195-
# "Q", # flake8-quotes
196-
# "RUF", # Ruff-specific rules
197-
# "S", # flake8-bandit
198-
# "SIM", # flake8-simplify
199-
# "SLF", # flake8-self
200-
# "T10", # flake8-debugger
201-
# "T20", # flake8-print
202-
# "TCH", # flake8-type-checking
203-
# "TD", # flake8-todos
204-
# "TID", # flake8-tidy-imports
205-
# "TRY", # tryceratops
206-
# "UP", # pyupgrade
207-
# "W", # pycodestyle
208-
# "YTT", # flake8-2020
158+
# https://docs.astral.sh/ruff/rules
159+
# "A", # flake8-builtins (variables or arguments shadowing built-ins)
160+
"AIR", # Airflow specific warnings
161+
# "ANN", # flake8-annotations (missing type annotations for arguments or return types)
162+
# "ARG", # flake8-unused-arguments (functions or methods with arguments that are never used)
163+
"ASYNC", # flake8-async (async await bugs)
164+
# "B", # flake8-bugbear (various likely bugs and design issues)
165+
# "BLE", # flake8-blind-except (force more specific exception types than just Exception)
166+
# "C4", # flake8-comprehensions (warn about things that could be written as a comprehensions but aren't)
167+
"C90", # McCabe cyclomatic complexity (warn about functions that are too complex)
168+
# "COM", # flake8-commas (forces commas at the end of every type of iterable/container
169+
# "CPY", # flake8-copyright (warn about missing copyright notice at top of file - currently in preview)
170+
# "D", # pydocstyle (warn about things like missing docstrings)
171+
# "DOC", # pydoclint (docstring warnings - currently in preview)
172+
"DJ", # flake8-django (Django-specific warnings)
173+
# "DTZ", # flake8-datetimez (warn about datetime calls where no timezone is specified)
174+
"E", # pycodestyle errors (warn about major stylistic issues like mixing spaces and tabs)
175+
# "EM", # flake8-errmsg (warn about exceptions that use string literals that aren't assigned to a variable first)
176+
# "ERA", # eradicate (warn about commented-out code)
177+
# "EXE", # flake8-executable (warn about files with a shebang present that aren't executable or vice versa)
178+
"F", # Pyflakes (a bunch of common warnings for things like unused imports, imports shadowed by variables, etc)
179+
"FA", # flake8-future-annotations (warn if certain from __future__ imports are used but missing)
180+
"FAST", # FastAPI specific warnings
181+
# "FBT", # flake8-boolean-trap (force all boolean arguments passed to functions to be keyword arguments and not positional)
182+
# "FIX", # flake8-fixme (warn about lines containing FIXME, TODO, XXX, or HACK)
183+
"FLY", # flynt (automatically convert from old school string .format to f-strings)
184+
# "FURB", # refurb (A tool for refurbishing and modernizing Python codebases)
185+
"G", # flake8-logging-format (warn about logging statements using outdated string formatting methods)
186+
"I", # isort (sort all import statements in the order established by isort)
187+
"ICN", # flake8-import-conventions (force idiomatic import conventions for certain modules typically imported as something else)
188+
# "INP", # flake8-no-pep420 (warn about files in the implicit namespace - i.e. force creation of __init__.py files to make packages)
189+
"INT", # flake8-gettext (warnings that only apply when you are internationalizing your strings)
190+
# "ISC", # flake8-implicit-str-concat (warnings related to implicit vs explicit string concatenation)
191+
# "LOG", # flake8-logging (warn about potential logger issues, but very pedantic)
192+
# "N", # pep8-naming (force idiomatic naming for classes, functions/methods, and variables/arguments)
193+
"NPY", # NumPy specific rules
194+
"PD", # pandas-vet (Pandas specific rules)
195+
# "PERF", # Perflint (warn about performance issues)
196+
# "PGH", # pygrep-hooks (force specific rule codes when ignoring type or linter issues on a line)
197+
# "PIE", # flake8-pie (eliminate unnecessary use of pass, range starting at 0, etc.)
198+
# "PLC", # Pylint Conventions
199+
"PLE", # Pylint Errors
200+
# "PLR", # Pylint Refactoring suggestions
201+
# "PLW", # Pylint Warnings
202+
# "PT", # flake8-pytest-style (warnings about unit test best practices)
203+
# "PTH", # flake8-use-pathlib (force use of pathlib instead of os.path)
204+
# "PYI", # flake8-pyi (warnings related to type hint best practices)
205+
# "Q", # flake8-quotes (force double quotes)
206+
# "RET", # flake8-return (various warnings related to implicit vs explicit return statements)
207+
"RSE", # flake8-raise (warn about unnecessary parentheses on raised exceptions)
208+
# "RUF", # Ruff-specific rules (miscellaneous grab bag of lint checks specific to Ruff)
209+
# "S", # flake8-bandit (security oriented checks, but extremely pedantic - do not attempt to apply to unit test files)
210+
# "SIM", # flake8-simplify (rules to attempt to simplify code)
211+
# "SLF", # flake8-self (warn when protected members are accessed outside of a class or file)
212+
# "SLOT", # flake8-slots (warn about subclasses that should define __slots__)
213+
"T10", # flake8-debugger (check for pdb traces left in Python code)
214+
# "T20", # flake8-print (warn about use of `print` or `pprint` - force use of loggers)
215+
# "TC", # flake8-type-checking (type checking warnings)
216+
# "TD", # flake8-todos (force all TODOs to include an author and issue link)
217+
"TID", # flake8-tidy-imports (extra import rules to check)
218+
# "TRY", # tryceratops (warnings related to exceptions and try/except)
219+
# "UP", # pyupgrade (A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language)
220+
"W", # pycodestyle warnings (warn about minor stylistic issues)
221+
# "YTT", # flake8-2020 (checks for misuse of sys.version or sys.version_info)
209222
]
210223
ignore = [
211-
# `ruff rule S101` for a description of that rule
212-
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME
213-
"B905", # `zip()` without an explicit `strict=` parameter -- FIX ME
214-
"E501", # Line too long
215-
"EM101", # Exception must not use a string literal, assign to variable first
216-
"EXE001", # Shebang is present but file is not executable -- DO NOT FIX
217-
"G004", # Logging statement uses f-string
218-
"PLC1901", # `{}` can be simplified to `{}` as an empty string is falsey
219-
"PLW060", # Using global for `{name}` but no assignment is done -- DO NOT FIX
220-
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
221-
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
222-
"PT018", # Assertion should be broken down into multiple parts
223-
"S101", # Use of `assert` detected -- DO NOT FIX
224-
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
225-
"SLF001", # Private member accessed: `_Iterator` -- FIX ME
226-
"UP038", # Use `X | Y` in `{}` call instead of `(X, Y)` -- DO NOT FIX
224+
# `uv run ruff rule E501` for a description of that rule
227225
]
228226

229227
# Allow fix for all enabled rules (when `--fix`) is provided.

0 commit comments

Comments
 (0)