37 lines
832 B
Markdown
37 lines
832 B
Markdown
### Task B3: Hook the validator into pre-commit
|
|
|
|
**Files:**
|
|
- Modify: `.pre-commit-config.yaml`
|
|
|
|
**Interfaces:**
|
|
- Produces: a local hook that runs `local/validate-patches.R` when the registry or patch files change.
|
|
|
|
- [ ] **Step 1: Add the hook**
|
|
|
|
Add a `repo: local` hook entry to `.pre-commit-config.yaml`:
|
|
|
|
```yaml
|
|
- repo: local
|
|
hooks:
|
|
- id: validate-patches
|
|
name: validate patch registry
|
|
entry: Rscript local/validate-patches.R
|
|
language: system
|
|
files: ^local/patches/
|
|
pass_filenames: false
|
|
```
|
|
|
|
- [ ] **Step 2: Verify the hook runs**
|
|
|
|
Run: `pre-commit run validate-patches --all-files`
|
|
Expected: hook passes (`Patch registry OK`).
|
|
|
|
- [ ] **Step 3: Commit**
|
|
|
|
```bash
|
|
git add .pre-commit-config.yaml
|
|
git commit -m "ci(patches): validate patch registry in pre-commit"
|
|
```
|
|
|
|
---
|
|
|