Add local pre-commit Codecov YAML validator - #269
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #269 +/- ##
=======================================
Coverage 94.92% 94.92%
=======================================
Files 48 48
Lines 3904 3904
=======================================
Hits 3706 3706
Misses 198 198 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@copilot the validation hook script wasn't able to reach the codecov validation endpoint. Double check your implementation against the documentation for codecov. Are we using the endpoint correctly? |
There was a problem hiding this comment.
Pull request overview
Adds a local pre-commit hook to validate codecov.yml by posting it to Codecov’s /validate endpoint, replacing a removed third-party hook and keeping config validation within the repo’s normal pre-commit execution.
Changes:
- Added
scripts/check_codecov_yaml.pyvalidator that POSTs YAML contents tohttps://codecov.io/validateand returns non-zero on failure. - Registered a new local pre-commit hook
validate-codecov-yamlscoped to^codecov\.yml$in.pre-commit-config.yaml.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/check_codecov_yaml.py | Implements the Codecov YAML validation CLI used by pre-commit. |
| .pre-commit-config.yaml | Registers the new local hook to run only for codecov.yml. |
Addressed in e7ec905. I verified the validator still targets Codecov’s documented endpoint ( |
medley56
left a comment
There was a problem hiding this comment.
We do not need a unit test suite for this. I'm glad you checked that it works but the real test is that it runs as part of CI! Remove the unit test suite.
Done in 927e409 — I removed the Codecov validator unit test file from |
|
@copilot The new hook is erroring in pre commit CI. The run log url is https://results.pre-commit.ci/run/github/612253190/1786068713.Yr21VbDoSMmwyrgfN-8WQA Examine the logs and determine what is going wrong. It looks like possibly there is some incompatibility with pre commit CI in the hook script. Read the pre commit documentation if it's helpful. |
Root cause is pre-commit.ci compatibility: this hook makes a live network call to |
Co-authored-by: medley56 <7018964+medley56@users.noreply.github.com>
Co-authored-by: medley56 <7018964+medley56@users.noreply.github.com>
Co-authored-by: medley56 <7018964+medley56@users.noreply.github.com>
Co-authored-by: medley56 <7018964+medley56@users.noreply.github.com>
Co-authored-by: medley56 <7018964+medley56@users.noreply.github.com>
df85525 to
5e02e81
Compare
|
@copilot Why did pre commit CI try to run the new hook? I thought we were skipping it now. Did it run from an old commit hash or something? |
Yes — that run URL is from an older commit before the skip landed. pre-commit.ci runs per commit SHA, so the historical run still shows the hook execution/failure for that earlier SHA. The current head ( |
|
@copilot I need you to trigger pre commit CI again. I think you can do it via a comment on the PR. |
@pre-commit-ci run |
|
@pre-commit-ci run |
1 similar comment
|
@pre-commit-ci run |
|
pre-commit.ci run |
|
@copilot The problem now is that ruff is failing on the new hook script. Examine the latest pre-commit.ci run logs and fix whatever ruff is complaining about in the new script. |
Co-authored-by: medley56 <7018964+medley56@users.noreply.github.com>
Fixed in |
Checklist
Summary
Replaces the removed third-party Codecov config hook with a local pre-commit hook that validates
codecov.ymlagainst Codecov’s validation API. The hook is defined underrepo: local, so it is eligible to run in pre-commit CI as part of normal hook execution.Hook registration
validate-codecov-yamlto.pre-commit-config.yaml^codecov\.yml$language: pythonandentry: python scripts/check_codecov_yaml.pyValidator implementation
scripts/check_codecov_yaml.pyhttps://codecov.io/validateExample