| Crates.io | cargo-preflight |
| lib.rs | cargo-preflight |
| version | 0.5.1 |
| created_at | 2022-08-18 19:31:48.175501+00 |
| updated_at | 2025-05-14 12:47:41.297081+00 |
| description | A custom Cargo subcommand to run local 'CI' on certain Git actions. |
| homepage | |
| repository | https://github.com/supinie/cargo-preflight |
| max_upload_size | |
| id | 648286 |
| size | 2,377,074 |
Preflight is a custom Cargo subcommand to run local "CI" on certain Git actions.
Preflight's aim is to ensure that trivially broken commits don't reach your remote, wasting CI time, adding extra fix commits, and most importantly saving you the embarrasment.
Preflight runs as a git hook to automatically run checks on commit or push.
cargo install cargo-preflight
Preflight can be configured by running:
cargo preflight --config
which will open a configuration wizard to walk you through the available options.
Alteratively, Preflight can be manually configured by editing the global ~/.config/cargo-preflight/preflight.toml configuration or local <your repo>/.preflight.toml configuration files.
[[preflight]] # Create new table entry for different behaviours
run_when = [
"commit",
"push",
] # Default values: ["push"]
# List of branch names to run on, below is an example.
# If the list is empty (default), then it will run on any branch.
branches = [
"main",
"my_feature",
"supinie_dev",
] # Default values: []
checks = [
"fmt", # `cargo fmt -- --check`
"clippy", # `cargo clippy -- -D warnings`
"test", # `cargo test`
"unused_deps", # uses `cargo-shear`
"secrets", # uses `ripsecrets`
"check_tests", # `cargo check --tests`
"check_examples", # `cargo check --examples`
"check_benches", # `cargo check --benches`
] # Default values: ["fmt", "test"]
autofix = false # Enables autofix functionality (for fmt and clippy)
over_ride = false # Enables override functionality
[[preflight]]
run_when = ["commit"]
branches = []
checks = [
"fmt",
"clippy",
]
autofix = true
over_ride = true
[[preflight]]
run_when = ["push"]
branches = [
"main",
"master",
]
checks = [
"fmt",
"clippy",
"test",
"unused_deps",
"secrets",
]
autofix = false
over_ride = false
Preflight can be enabled in a repository by running:
cargo preflight --init
Preflight can also be run as a one-off test with the cargo preflight command.
Note: Currently, Preflight only supports Linux systems.
cargo publishThese are in no particular order, and many will introduce breaking changes.