Skip to content

Commit 2ddaab9

Browse files
committed
chore: trim down .pre-commit-config.yaml
1 parent 0499a05 commit 2ddaab9

File tree

1 file changed

+6
-51
lines changed

1 file changed

+6
-51
lines changed
Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,23 @@
11
# .pre-commit-config.yaml
22
# See https://pre-commit.com/
3+
default_stages: [commit]
34

4-
# This file configures the pre-commit framework, listing hooks that run on staged files before commits.
5-
# Ruff is configured to run the full set of enabled linting rules and formatting on files in the commit.
6-
7-
# --- Default settings for hooks if not overridden ---
8-
default_stages: [commit] # Run hooks by default on 'commit' stage
9-
10-
# Exclude patterns for hooks (relative to project root).
11-
# Ensure consistency with .gitignore. Hooks often have built-in excludes for standard dirs.
12-
# exclude: ^docs/.*$ # Example exclude for documentation source files (handled by Ruff excludes often)
13-
14-
# --- Repositories containing hooks ---
155
repos:
16-
# Standard pre-commit hooks provided by the framework developers.
17-
# See https://github.com/pre-commit/pre-commit-hooks
186
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
# Use a specific tag or commit hash (pinning for reproducibility).
20-
rev: v4.6.0 # Update periodically to get newer hooks/fixes.
7+
rev: v4.6.0
218
hooks:
22-
# Prevent adding large files that should probably be in Git LFS or ignored.
239
- id: check-added-large-files
24-
args: ["--max-size=1000000"] # Set max file size to 1MB (adjust as needed).
25-
26-
# Check YAML files (e.g., CI workflows, Docker Compose) for syntax errors.
10+
args: ["--max-size=1000000"]
2711
- id: check-yaml
28-
29-
# Check TOML files (e.g., pyproject.toml, .ruff.toml) for syntax errors.
3012
- id: check-toml
31-
32-
# Ensure files end with a single newline and are not excessively blank at the end.
3313
- id: end-of-file-fixer
34-
35-
# Removes unwanted trailing whitespace from lines.
3614
- id: trailing-whitespace
3715

38-
# Ruff hooks (Formatter and Linter checks) from Astral.
39-
# See https://github.com/astral-sh/ruff-pre-commit
40-
# Match the rev/version to the version of Ruff used in the template's pyproject.toml dependencies.
41-
- repo: https://github.com/astral-sh/ruff-pre-commit # Official hooks from Astral (Ruff creator)
42-
# Pin to the version of Ruff used in pyproject.toml (or a compatible version).
43-
rev: v0.3.5 # **Ensure this matches/is compatible with the Ruff version in pyproject.toml**
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.3.5
4418
hooks:
45-
# Run the Ruff formatter (covers code formatting and import sorting).
46-
# Automatically fixes issues like line length, spacing, quotes, and sorts imports.
47-
# Run this hook first so the linter doesn't report fixable style issues.
4819
- id: ruff-format
49-
# Explicitly point to the separate ruff config file.
50-
args: [--config={{ PROJECT_SLUG }}/.ruff.toml] # Path relative to project root.
20+
args: [--config={{ PROJECT_SLUG }}/.ruff.toml]
5121

52-
# Run the Ruff linter.
53-
# This hook runs the *full set of enabled linting rules* configured in .ruff.toml.
54-
# Use --fix to automatically fix many lint issues.
55-
# Use --exit-non-zero-on-fix to make the commit fail if any fixes were applied
56-
# (prompts user to 'git add' and re-commit the corrected files).
5722
- id: ruff
5823
args: [--fix, --exit-non-zero-on-fix, --config={{ PROJECT_SLUG }}/.ruff.toml]
59-
60-
61-
# --- Optional Hooks ---
62-
# Add hooks for other tools if they are fast enough for pre-commit and needed.
63-
# Ensure any tools used here are listed as development dependencies in pyproject.toml
64-
# so pre-commit can install them.
65-
66-
# Note: More time-consuming checks (e.g., full Pyright, comprehensive Bandit/pip-audit scans)
67-
# are typically too slow for mandated pre-commit hooks across large projects.
68-
# These are run via Task Automation (Nox) and enforced in CI.

0 commit comments

Comments
 (0)