- Moved all hookify configuration files from `.claude/` to `.claude/hooks/` subdirectory for better organization - Added four new blocking hooks to prevent common error handling anti-patterns: - `block-broad-exception-handler`: Prevents catching generic `Exception` with only logging - `block-datetime-now-fallback`: Blocks returning `datetime.now()` as fallback on parse failures to prevent data corruption - `block-default
33 lines
988 B
Markdown
33 lines
988 B
Markdown
---
|
|
name: block-linter-config-python
|
|
enabled: true
|
|
event: file
|
|
action: block
|
|
conditions:
|
|
- field: file_path
|
|
operator: regex_match
|
|
pattern: ^(?!.*\.venv/).*(?:pyproject\.toml|\.?ruff\.toml|\.?pyrightconfig\.json|\.?mypy\.ini|setup\.cfg|\.flake8|tox\.ini|\.?pylintrc)$
|
|
---
|
|
|
|
🚫 **BLOCKED: Linter Configuration Edit Attempt**
|
|
|
|
You are attempting to edit a Python linter configuration file.
|
|
|
|
**Protected files include:**
|
|
- `pyproject.toml` (contains ruff, mypy, pyright, black settings)
|
|
- `.ruff.toml` / `ruff.toml`
|
|
- `.pyrightconfig.json` / `pyrightconfig.json`
|
|
- `.mypy.ini` / `mypy.ini`
|
|
- `setup.cfg` (may contain flake8, mypy settings)
|
|
- `.flake8`
|
|
- `tox.ini`
|
|
- `.pylintrc` / `pylintrc`
|
|
|
|
**Why this is blocked:**
|
|
Linter configurations are carefully tuned for this project. Changes require explicit user approval.
|
|
|
|
**If you need to modify linter settings:**
|
|
1. Ask the user for explicit permission
|
|
2. Explain what change is needed and why
|
|
3. Wait for approval before proceeding
|