Giter Club home page Giter Club logo

cargo-scout's Introduction

cargo-scout

Contributor Covenant Travis Build Status MPL 2.0 License MIT License

Leave this world a little better than you found it

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

Current Status

cargo-scout is experimental and in a very rough draft for now.

The current minimum Rust version supported is 1.37 stable.

Prerequisites

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!

How to install

$ cargo install cargo-scout

How to run it

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 ^^').

Code of Conduct

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.

License

Licensed under either of

at your option.

Dual MIT/Apache2 is strictly more permissive

cargo-scout's People

Contributors

cbonaudo avatar daubaris avatar ebroto avatar o0ignition0o avatar oscape avatar undef1nd avatar yonip23 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.