42 lines
1.4 KiB
Markdown
42 lines
1.4 KiB
Markdown
# Task B3: Hook the validator into pre-commit — Report
|
|
|
|
## Step 1: Added the hook
|
|
|
|
Added the following block to `.pre-commit-config.yaml` (lines 46-51), appended to the existing `repo: local` section:
|
|
|
|
```yaml
|
|
- id: validate-patches
|
|
name: validate patch registry
|
|
entry: Rscript local/validate-patches.R
|
|
language: system
|
|
files: ^local/patches/
|
|
pass_filenames: false
|
|
```
|
|
|
|
The hook was integrated alongside the existing `yaml-file-extension` hook, maintaining consistent indentation and YAML structure.
|
|
|
|
## Step 2: Verified the hook runs
|
|
|
|
Ran: `pre-commit run validate-patches --all-files`
|
|
|
|
Output:
|
|
```
|
|
[INFO] Initializing environment for https://github.com/rbubley/mirrors-prettier.
|
|
[INFO] Initializing environment for https://github.com/rbubley/mirrors-prettier:prettier@3.9.1.
|
|
[INFO] Initializing environment for https://github.com/posit-dev/air-pre-commit.
|
|
[INFO] Initializing environment for https://github.com/editorconfig-checker/editorconfig-checker.
|
|
validate patch registry..................................................Passed
|
|
```
|
|
|
|
Hook passed successfully (pre-commit is installed in this environment).
|
|
|
|
## Step 3: Committed
|
|
|
|
```
|
|
git add .pre-commit-config.yaml && git commit -m "ci(patches): validate patch registry in pre-commit"
|
|
```
|
|
|
|
Commit: `912423f ci(patches): validate patch registry in pre-commit`
|
|
|
|
---
|
|
**Status:** Complete. Hook added, verified, and committed successfully.
|