Last active
April 1, 2026 01:45
-
-
Save skorotkiewicz/aa76c873bb4cb90375b965035fc0f2db to your computer and use it in GitHub Desktop.
Justfile for Rust projects with pre-commit
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
| # Justfile | |
| # https://github.com/casey/just | |
| default: | |
| @just --list | |
| build: | |
| cargo build --release | |
| run *args: | |
| cargo run -- {{args}} | |
| fmt: | |
| cargo fmt | |
| cargo clippy --all-targets --all-features -- -D warnings | |
| # cargo shear --fix # first install shear: cargo install shear | |
| check: | |
| cargo fmt --check | |
| cargo clippy --all-targets --all-features -- -D warnings | |
| install-hook: | |
| #!/usr/bin/env bash | |
| cat > .git/hooks/pre-commit << 'EOF' | |
| #!/bin/sh | |
| set -e | |
| echo "Running pre-commit quality checks..." | |
| just check | |
| EOF | |
| chmod +x .git/hooks/pre-commit | |
| echo "Pre-commit hook installation confirmed." | |
| remove-hook: | |
| rm .git/hooks/pre-commit | |
| echo "Pre-commit hook uninstallation confirmed." | |
| # Run unit tests | |
| test: fmt | |
| cargo test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment