Install, configure, update, or tune anti-slopr in a Rust repository — the strict rustc/Clippy lint profile, the anti-slopr Dylint library, and cargo-deny bans. Use when adding anti-slopr, adopting it incrementally in an existing codebase, upgrading to a newer anti-slopr release, or deciding how to fix or suppress its findings.
Resources
1Install
npx skillscat add oliverjames2024/anti-slopr/install-anti-slopr Install via the SkillsCat registry.
Install or update anti-slopr
anti-slopr has three layers. Install all three unless the user narrows the scope:
| Layer | Files it touches | Toolchain |
|---|---|---|
| Lint profile | [workspace.lints] in Cargo.toml, clippy.toml |
stable |
| Dylint library | [workspace.metadata.dylint] in Cargo.toml, optional dylint.toml |
pinned nightly, installed automatically by Dylint |
| Dependency bans | deny.toml |
stable (cargo-deny) |
The repository owns the result. Preserve existing lint levels, clippy settings, and deny policy; when the profile conflicts with an explicit local choice, keep the local choice and tell the user.
Upstream: https://github.com/oliverjames2024/anti-slopr. Profile sources live under profile/ and the Dylint library under lints/. Read the files from the release the user wants (default: the latest tag); do not reproduce them from memory.
Choose the path
Read the repository's agent instructions, git status, the root Cargo.toml, any clippy.toml/.clippy.toml, deny.toml, dylint.toml, and rust-toolchain(.toml).
- Existing installation (a
[workspace.metadata.dylint]entry naming anti-slopr, or ananti-sloprcomment in the lint tables): follow Update. - Fresh install: follow the steps below.
Complete when the target workspace root and any pre-existing uncommitted work are identified.
Fresh install
Lint profile. Merge
profile/lints.tomlinto the root manifest.- Workspace: merge into
[workspace.lints.rust],[workspace.lints.rustdoc],[workspace.lints.clippy], and[workspace.lints.rust.unexpected_cfgs]. Add[lints] workspace = trueto every member that lacks a[lints]table. A member with its own[lints]table cannot also inherit: show the user and ask. - Single package: use
[lints.*]instead of[workspace.lints.*]. - Keep existing entries. Keep the explanatory comments; they are the policy's documentation.
- Merge
profile/clippy.tomlinto the rootclippy.toml. Clippy rejects unknown keys, so run Clippy afterwards to validate. Mergedisallowed-*lists bypathinstead of replacing them. - If the repository sets
msrv/rust-versionbelow a lint's availability, Clippy reports unknown lints; remove those entries and say so.
Complete when
cargo clippy --workspace --all-targetsruns without configuration errors or unknown-lint warnings.- Workspace: merge into
Dylint library. Install the tools if missing, preferring prebuilt binaries:
cargo binstall --no-confirm cargo-dylint dylint-link || cargo install cargo-dylint dylint-linkThen add to the root
Cargo.toml(ordylint.toml), pinning the release tag:[workspace.metadata.dylint] libraries = [ { git = "https://github.com/oliverjames2024/anti-slopr", tag = "<release tag>", pattern = "lints" }, ]For a vendored copy instead (no network at lint time, local edits), copy
lints/totools/anti-slopr/and use{ path = "tools/anti-slopr" }. Exclude that directory from the consuming workspace (exclude = ["tools/anti-slopr"]): it builds with its own nightly toolchain.Run
cargo dylint --all -- --all-targets. The first run downloads the pinned nightly and builds the library; later runs are cached.Complete when
cargo dylint --allfinishes and reports anti-slopr diagnostics (or none).Dependency bans. Merge
profile/deny.toml's[bans]entries intodeny.toml(create it withcargo deny initif absent and the user agrees to adopt cargo-deny). If a banned crate is already a dependency, do not remove it; report it.CI. Add or extend a CI job:
- run: cargo clippy --workspace --all-targets --all-features -- -D warnings - run: cargo binstall --no-confirm cargo-dylint dylint-link - run: cargo dylint --all -- --all-targets env: DYLINT_RUSTFLAGS: -D warnings - run: cargo deny check bans # if cargo-deny was adoptedCache
~/.cargo,~/.rustup/toolchains,~/.dylint_drivers, andtarget/.Report the baseline. Count findings per lint for Clippy and Dylint. Do not mass-fix or mass-suppress. Present the counts and offer the adoption strategies below.
Adopting in an existing codebase
Large existing codebases usually produce many findings. Offer, in order of preference:
- Fix by lint, highest-signal first: suppression lints (
allow_attributes*,blanket_lint_suppression), error-handling lints, then the rest. One commit per lint keeps review tractable. - Ratchet: temporarily lower specific lints to
"warn"in the manifest with a# anti-slopr: ratchetcomment, keep CI on-D warningsfor everything else, and remove the ratchet entries as the counts reach zero. - Disable a Dylint lint for the whole workspace with
DYLINT_RUSTFLAGS="-A <lint>"only when the team disagrees with the policy; record that decision in the repository's agent instructions.
Fixing findings
The point of anti-slopr is to change code, not to silence it. When fixing:
Prefer the replacement the diagnostic suggests. Read the lint's documentation (
README.mdin the upstream repository) when the fix is not obvious.A suppression must be
#[expect(lint, reason = "...")]on the narrowest item, with a reason that records the invariant or evidence. For anti-slopr lints, wrap it so plaincargobuilds do not warn about an unknown lint:#[cfg_attr(dylint_lib = "anti_slopr", expect(untyped_value_in_signature, reason = "forwards arbitrary JSON from the webhook body to the audit log unchanged"))]Never add crate- or module-level
#![allow], never suppress a lint group, and never weaken a test to make a lint pass.