Skip to content

Pre commit hook suite for code#161

Open
gloskull wants to merge 2 commits into
Utility-Protocol:mainfrom
gloskull:Pre-Commit-Hook-Suite-for-Code
Open

Pre commit hook suite for code#161
gloskull wants to merge 2 commits into
Utility-Protocol:mainfrom
gloskull:Pre-Commit-Hook-Suite-for-Code

Conversation

@gloskull

Copy link
Copy Markdown
Contributor

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

@JerryIdoko

Copy link
Copy Markdown

resolve conflicts @gloskull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pre-Commit Hook Suite for Code Quality Enforcement

2 participants