A cargo subcommand to get clippy::pedantic lints or rustfmt lints for the changes you have made in a codebase.
Commands and their bash pseudocode would probably look like this:
# run clippy pedantic on a diff
$ cargo-scout lint # git diff | cargo clippy -- -D clippy::pedantic
# run rustfmt on a diff
$ cargo-scout fmt # git diff | cargo fmt --check
There's more to it (the commented code wouldn't work), such as workspace management and quite a lot of flags that will hopefully match your usecase. You can find them by running the commands with -h or --help.
If cargo-scout is missing a feature for you to use it, consider filing an issue!
$ cargo-scout -h
$ cargo-scout lint -h
$ cargo-scout fmt -h
cargo-scout is experimental and in a very rough draft for now.
The current minimum Rust version supported is 1.37 stable.
Git: In order to compute a set of changes, it requires a project running git.
The linter uses clippy and the formatter uses rustfmt. Head over to the respective links to figure out how to install it.
Rust nightly: Some commands require a nightly edition of rust, because the features we use aren't available in stable yet (rustfmt --emit json and some cargo clippy features in a workspace setting).
We try to keep a close eye to the relevant tracking issues and hope we can switch it to stable soon. If the issues evolved and we didn't notice, please file an issue and let us know!
$ cargo install cargo-scout
Open a shell, go to the project you would like to run the command in, and run cargo-scout, with an optional target branch:
$ cargo-scout lint # clippy::pedantic lints on a diff with HEAD
$ cargo-scout fmt # rustfmt lints on a diff with HEAD
Each command and subcommand supports -h and --help:
A git diff will be queried and clippy will be run as well, searching for lints that may apply to your diff.
If some lints can apply, the command execution will error out. This design decision has been made so you can put it in your CI pipeline at some point (but please wait for 1.0 release ^^').
We have a Code of Conduct so as to create a more enjoyable community and work environment. Please see the CODE_OF_CONDUCT file for more details.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dual MIT/Apache2 is strictly more permissive