Pre commit hook suite for code#161
Open
gloskull wants to merge 2 commits into
Open
Conversation
Add pre-commit code quality hook suite
|
resolve conflicts @gloskull |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Enforce local quality gates that catch file-hygiene, spelling, Rust formatting/linting, fast tests, and high-risk credential patterns before changes reach CI.
Description
Add .pre-commit-config.yaml to run file-hygiene hooks, typos, local cargo fmt/cargo clippy/fast cargo test, and a local security-patterns hook.
Add scripts/pre-commit-security.sh, a lightweight credential-pattern scanner that fails commits containing probable secrets outside approved paths.
Add docs/runbooks/pre-commit-hooks.md documenting architecture, installation, rollout, monitoring, and troubleshooting for the hook suite.
Wire the pre-commit suite into CI by adding a pre-commit job in .github/workflows/backend-ci.yml to run pre-commit run --all-files as a backstop.
Update README.md development instructions to include installing and running the local pre-commit quality gate.
Testing
ruby -e 'require "yaml"; YAML.load_file(ARGV...)' .pre-commit-config.yaml .github/workflows/backend-ci.yml — parsing succeeded.
bash -n scripts/pre-commit-security.sh and scripts/pre-commit-security.sh — script syntax and execution passed after adjusting the regex quoting to reduce false positives.
cargo fmt --all -- --check — passed.
git diff --cached --check — passed.
python -m pip install --user pre-commit — could not complete in this environment due to package-index access returning 403 Forbidden (environment limitation).
cargo test --all-features --lib --bins with system rustc 1.89.0 failed because the locked fixed crate requires rustc 1.93; running cargo +1.93.0 test was attempted but native dependency compilation did not finish within the execution window.
Closes #136