chore: consolidate redundant pre-commit hooks into ruff #19

Open
opened 2026-02-26 01:25:09 +01:00 by Philipp · 0 comments
Owner

The current .pre-commit-config.yaml contains several hooks that can be replaced or consolidated by ruff, which is already used in the project. Consolidating these hooks reduces overhead and simplifies maintenance.

Redundant hooks that Ruff can handle:

  • check-ast: Ruff parses the AST and will fail on syntax errors.
  • check-docstring-first: Ruff's D rules (e.g., D301) can handle docstring placement.
  • trailing-whitespace: Ruff can handle this via W291 and W293.
  • end-of-file-fixer: Ruff can handle this via W292.

Recommendation:
Evaluate expanding tool.ruff.lint.select to include these rules and subsequently removing the corresponding hooks from pre-commit-hooks.

The current `.pre-commit-config.yaml` contains several hooks that can be replaced or consolidated by `ruff`, which is already used in the project. Consolidating these hooks reduces overhead and simplifies maintenance. Redundant hooks that Ruff can handle: - `check-ast`: Ruff parses the AST and will fail on syntax errors. - `check-docstring-first`: Ruff's `D` rules (e.g., `D301`) can handle docstring placement. - `trailing-whitespace`: Ruff can handle this via `W291` and `W293`. - `end-of-file-fixer`: Ruff can handle this via `W292`. Recommendation: Evaluate expanding `tool.ruff.lint.select` to include these rules and subsequently removing the corresponding hooks from `pre-commit-hooks`.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Philipp/template-git#19