Skip to content

Commit 3a4952b

Browse files
committed
fix: clean up old pre-commit implementation
Remove the old pre-commit script and rely instead on the pre-commit command to run the linters. Update the documentation to reflect the change in how the hook should be configured.
1 parent c1f0828 commit 3a4952b

File tree

4 files changed

+14
-74
lines changed

4 files changed

+14
-74
lines changed

AGENTS.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,22 @@ hatch run test:test <filepath> --log-level DEBUG
6565
### Project-Wide Commands (ASK BEFORE RUNNING)
6666

6767
```bash
68-
hatch run lint:fix # Format all code
69-
hatch run test:test # Full test suite (slow!)
70-
hatch run mypy:check # Type check everything
71-
hatch run lint:check # Final lint check (includes pre-commit hooks)
68+
hatch run lint:fix # Format all code
69+
hatch run test:test # Full test suite (slow!)
70+
hatch run mypy:check # Type check everything
71+
hatch run lint:check # Final lint check
72+
hatch run lint:precommit # All linters and other pre-commit hooks
7273
```
7374

7475
### Pre-commit Hooks
7576

7677
The project uses pre-commit hooks to automatically check file formatting:
78+
7779
- **File endings**: Ensures all files end with a single newline
7880
- **Whitespace**: Removes trailing whitespace
7981
- **Syntax**: Validates YAML/TOML files
8082
- **Conflicts**: Prevents committing merge conflict markers
83+
- **Linters**: Runs the `mypy` and `ruff` linters
8184

8285
These run automatically on commit if installed with `hatch run lint:install-hooks`.
8386

CONTRIBUTING.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ git remote add upstream https://github.com/python-wheel-build/fromager.git
4545
# 4. Create development environment
4646
hatch env create
4747

48-
# 5. Install pre-commit hook (optional but recommended)
49-
./scripts/setup-pre-commit-hook.sh
48+
# 5. Install pre-commit hooks (optional but recommended)
49+
hatch run lint:install-hooks
5050
```
5151

5252
### Contribution Workflow
@@ -64,7 +64,7 @@ git checkout -b feat/<short-description>
6464
hatch run test:test tests/test_<module>.py # Test your specific changes
6565

6666
# 4. Before committing, run full quality checks
67-
hatch run lint:fix && hatch run test:test && hatch run mypy:check && hatch run lint:check
67+
hatch run lint:precommit
6868

6969
# 5. Commit using Conventional Commits
7070
git commit -m "feat(scope): short summary"
@@ -81,18 +81,16 @@ To ensure quality checks run automatically before each commit, install the pre-c
8181

8282
```bash
8383
# Install the pre-commit hook (run once after cloning)
84-
./scripts/setup-pre-commit-hook.sh
84+
hatch run lint:install-hooks
8585

86-
# The hook automatically runs before each commit:
87-
# - hatch run lint:check
88-
# - hatch run mypy:check
86+
# The hook automatically runs a selection of linters before each commit.
8987

9088
# If the hook fails, it will prevent the commit and show helpful messages
91-
# You can fix issues automatically with:
89+
# You can fix some issues automatically with:
9290
hatch run lint:fix
9391
```
9492

95-
The pre-commit hook prevents commits that would fail CI quality checks, saving time and ensuring consistent code quality.
93+
The pre-commit hook prevents commits that would fail some CI quality checks, saving time and ensuring consistent code quality.
9694

9795
---
9896

scripts/pre-commit

Lines changed: 0 additions & 26 deletions
This file was deleted.

scripts/setup-pre-commit-hook.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)