Introduce pre-commit hooks and update contribution guidelines
- Add `.pre-commit-config.yaml` with hooks for formatting, linting, and general file checks. - Update `CONTRIBUTING.md` to include pre-commit setup instructions and emphasize automated checks during commits. - Provide detailed steps for installing and running pre-commit hooks.
This commit is contained in:
34
.pre-commit-config.yaml
Normal file
34
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
# Pre-commit hooks configuration
|
||||
# See https://pre-commit.com for more information
|
||||
|
||||
repos:
|
||||
# General file checks
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-toml
|
||||
- id: check-merge-conflict
|
||||
- id: check-added-large-files
|
||||
args: ['--maxkb=1000']
|
||||
- id: mixed-line-ending
|
||||
|
||||
# Rust formatting
|
||||
- repo: https://github.com/doublify/pre-commit-rust
|
||||
rev: v1.0
|
||||
hooks:
|
||||
- id: fmt
|
||||
name: cargo fmt
|
||||
description: Format Rust code with rustfmt
|
||||
- id: cargo-check
|
||||
name: cargo check
|
||||
description: Check Rust code compilation
|
||||
- id: clippy
|
||||
name: cargo clippy
|
||||
description: Lint Rust code with clippy
|
||||
args: ['--all-features', '--', '-D', 'warnings']
|
||||
|
||||
# Optional: run on all files when config changes
|
||||
default_install_hook_types: [pre-commit, pre-push]
|
||||
Reference in New Issue
Block a user