Skip to content

Pre commit hook suite#109

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

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

Conversation

@gloskull

Copy link
Copy Markdown
Contributor

Motivation
Enforce repository-wide code quality gates locally before PRs by running deterministic checks for the Rust workspace and the usage dashboard.
Keep commit hooks fast and network-free by running only relevant checks and avoiding dependency installs inside the hook.
Make the hook easy to run manually and document its behavior for contributors.
Description
Add .pre-commit-config.yaml to register a repository-local hook utility-contracts-quality-suite scoped to contracts/, usage-dashboard/, the hook script, and the pre-commit config, and configured to receive changed filenames.
Add scripts/pre-commit-quality.sh, a POSIX shell runner that accepts --all or filenames, detects changed paths, and selectively runs cargo fmt --manifest-path "contracts/Cargo.toml" --all -- --check, cargo clippy --manifest-path "contracts/Cargo.toml" --all-targets --all-features -- -D warnings, cargo test --manifest-path "contracts/Cargo.toml" --all-features, and npm --prefix usage-dashboard run lint when applicable.
Add docs/PRE_COMMIT_QUALITY.md documenting architecture, quality gates, installation, manual execution, and operational notes.
Testing
Ran a syntax check with bash -n scripts/pre-commit-quality.sh, which succeeded.
Executed the script with representative filenames with scripts/pre-commit-quality.sh docs/PRE_COMMIT_QUALITY.md .pre-commit-config.yaml scripts/pre-commit-quality.sh, which completed successfully and correctly skipped unrelated checks.
Verified the hook file and script are present and executable by running the script in the repository root and observing expected behavior (selective skipping and success messages).
Closes #81

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

1 participant