leash 0.1.0

Shareable Clippy lint presets for teams and orgs
# leash

> Early prototype. API will change.

Cargo has no way to share `[lints]` config between repos. You can define lints
in `Cargo.toml`, but you can't point at someone else's config and say "use
these." If you want consistent lint enforcement across multiple projects, you're
copying and pasting.

leash is a workaround: it wraps `cargo clippy` and passes a fixed set of lint
flags based on a named preset. Put a `leash.toml` in your project root, pick a
preset, and `leash` runs clippy with those flags.

## Installation

```sh
cargo install leash
```

## Configuration

Add a `leash.toml` to your project root:

```toml
preset = "secure"
```

## Usage

```sh
leash                    # run clippy with the preset's flags
leash --list             # print available presets
leash --dry-run          # print the clippy command without running it
leash -- --all-features  # pass cargo-level flags
```

Args after `--` go to cargo, not clippy. So `leash -- --all-features` becomes
`cargo clippy --all-features -- <lint flags>`.

## Presets

### secure

Forbids panic macros and unsafe shortcuts. Denies fallible casts, unwraps, and
unsafe patterns.

Forbid: `clippy::panic`, `clippy::todo`, `clippy::unimplemented`,
`clippy::exit`, `clippy::undocumented_unsafe_blocks`,
`clippy::multiple_unsafe_ops_per_block`

Deny: `clippy::unwrap_used`, `clippy::expect_used`, `clippy::unwrap_in_result`,
`clippy::panic_in_result_fn`, `clippy::get_unwrap`, `clippy::indexing_slicing`,
`clippy::string_slice`, `clippy::arithmetic_side_effects`,
`clippy::cast_possible_truncation`, `clippy::cast_possible_wrap`,
`clippy::cast_sign_loss`, `clippy::as_conversions`,
`clippy::as_pointer_underscore`, `clippy::fallible_impl_from`,
`clippy::unused_result_ok`, `clippy::mem_forget`, `clippy::large_stack_arrays`,
`clippy::large_stack_frames`, `clippy::std_instead_of_core`,
`clippy::allow_attributes_without_reason`, `clippy::missing_safety_doc`,
`clippy::unreachable`, `unsafe_op_in_unsafe_fn`

### pedantic

Everything in `secure`, plus `clippy::pedantic` and a few more strictness lints.

Additional deny: `clippy::pedantic`, `clippy::dbg_macro`,
`clippy::print_stdout`, `clippy::print_stderr`, `clippy::shadow_reuse`,
`clippy::shadow_unrelated`, `clippy::missing_assert_message`,
`clippy::default_numeric_fallback`, `clippy::integer_division`,
`clippy::float_arithmetic`

## Planned

- Remote preset URLs
- Preset inheritance and overrides
- Injecting lints directly into `Cargo.toml`

## License

This project is licensed under the [EUPL](https://eupl.eu/). For more
information, please see the [LICENSE](LICENSE) file.