Cargo subcommand command that provides easy access to the cargo-culture-kit's default rules and provides an exemplar for the development of rule-checking binaries.
cargo-culture
is a Rust project, and manages its dependencies with cargo
,
available as part of the standard Rust toolchain.
For local program development, you can build cargo-culture
with:
bash
git clone https://github.com/PolySync/cargo-culture.git
cd cargo-culture/cargo-culture
bash
cargo build
You can install cargo-culture
directly from crates.io.
bash
cargo install cargo-culture
bash
git clone https://github.com/PolySync/cargo-culture.git
cd cargo-culture/cargo-culture
cargo install
The easiest way to use cargo-culture
is simply to run it from the
root directory of a Rust project:
```bash cd myrustproject
cargo culture ```
More detailed usage: ```bash $ cargo culture --help
USAGE: cargo culture [FLAGS] [OPTIONS]
FLAGS: -h, --help Prints help information -V, --version Prints version information -v, --verbose If present, emit extraneous explanations and superfluous details
OPTIONS:
--culture-checklist-path
--manifest-path <manifest_path>
The location of the Cargo manifest for the project to check [default: ./Cargo.toml]
```
cargo culture
with the default rules for a Rust project
that needs a bit of work may look like the following:
bash
$ cargo culture
Should have a well-formed Cargo.toml file readable by `cargo metadata` ... ok
Should have a CONTRIBUTING file in the project directory. ... FAILED
Should have a LICENSE file in the project directory. ... ok
Should have a README.md file in the project directory. ... ok
Should have a rustfmt.toml file in the project directory. ... FAILED
Should have a file suggesting the use of a continuous integration system. ... FAILED
Should `cargo clean` and `cargo build` without any warnings or errors. ... ok
Should have multiple tests which pass. ... ok
Should be under source control. ... ok
Should be making an effort to use property based tests. ... ok
culture result: FAILED. 7 passed. 3 failed. 0 undetermined.
cargo culture
checks against projects not in the
current working directory with the --manifest-path
option.
bash
cargo culture --manifest-path $HOME/some/other/project/Cargo.toml
To apply only a subset of available rules, you can supply a .culture
file in your project directory. This file should contain a line-separated
list of Rule
descriptions.
```bash $ cat > .culture << EOL Should have a LICENSE file in the project directory. Should have a README.md file in the project directory. EOL
$ cargo culture Should have a LICENSE file in the project directory. ... ok Should have a README.md file in the project directory. ... ok culture result: ok. 2 passed. 0 failed. 0 undetermined. ```
You can also select a subset of rules from a checklist
file at a specific location by providing the
--culture-checklist-path
option.
```bash
$ cat > myculturechecklist.txt << EOL
Should have a LICENSE file in the project directory.
Should have a README.md file in the project directory.
EOL
$ cargo culture --culture-checklist-path myculturechecklist.txt Should have a LICENSE file in the project directory. ... ok Should have a README.md file in the project directory. ... ok culture result: ok. 2 passed. 0 failed. 0 undetermined. ```
The cargo-culture
tests are managed through the standard
cargo-integrated Rust test framework, with additional enhancement
through the proptest property based testing library.
To build but not run the tests:
bash
cargo build --tests
To both build and run the tests:
bash
cargo test
© 2018, PolySync Technologies, Inc.
Please see the LICENSE file for more details