feat: add tari lint command - #191
Merged
Merged
Conversation
Checks a template crate for issues that hurt the published WASM binary or the developer experience, each reported with a copy-pasteable fix: - `rust::clippy` — runs `cargo clippy --target wasm32-unknown-unknown` and renders its diagnostics inline - `cargo::crate-type` — `[lib] crate-type` must be exactly `["cdylib"]`; extra types such as `rlib` are compiled and linked in, bloating the binary - `cargo::release-profile` — the size-optimizing `opt-level`/`lto`/ `codegen-units`/`panic`/`strip` settings - `cargo::test-runtime-profile` — dev `opt-level` for the wasmer/cranelift crates, without which template tests run ~10x slower - `template::metadata` — `description` and `[package.metadata.tari-template]`, suggesting the `tari template init` invocation that fills them in - `template::metadata-build` — the metadata build dependency and build.rs `--fix` applies everything that does not need the author's input: clippy's machine-applicable suggestions, both profile sections, `crate-type`, and the metadata build script. Cargo only honours `[profile.*]` in the workspace root, so profile checks read and write that manifest when the template is a member. Also `--no-clippy`, `-D/--deny-warnings`, and exit 1 on errors for CI. Missing toolchain pieces are reported as findings with the `rustup` command to run. Aliases: `tari lints`, `tari check`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
It skips the unwinding machinery entirely, so it is at least as good as 'abort' for binary size and should not be flagged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
New `tari lint` command, so a minor bump. Also bumps the tari_ootle_publish_lib path dependency requirement to 0.23 so `cargo publish --locked` can resolve it against crates.io. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
tari lint(aliaseslints,check) — checks a template crate for issues that hurt the published WASM binary or the developer experience. Every check except the Rust lints prints the exact fix, and most can be applied with--fix.Checks
rust::clippycargo clippy --target wasm32-unknown-unknown, renders its diagnostics inlinecargo::crate-type[lib] crate-typemust be exactly["cdylib"]; missing or non-cdylib is an error, extras likerliba warning (each extra type is compiled and linked in)cargo::release-profileopt-level/lto/codegen-units/panic/strip, listing only the keys actually missingcargo::test-runtime-profileopt-levelfor the six wasmer/cranelift crates, without which template tests run ~10x slower. Only checked when the crate has teststemplate::metadatadescription+[package.metadata.tari-template]fields, suggesting the exacttari template init -y --…invocationtemplate::metadata-buildtari_ootle_template_buildbuild-dep and abuild.rscallingTemplateMetadataBuilder--fixApplies everything that does not need the author's input: clippy's machine-applicable suggestions (
cargo clippy --fix --allow-dirty), both profile sections,crate-type, andinit_metadata::auto_initfor the build script.template::metadatais deliberately not auto-fixable — only the author knows the values — and abuild.rsthat exists but does something unrelated is never rewritten.Cargo only honours
[profile.*]in the workspace root manifest, so profile checks read (and--fixwrites) that manifest when the template is a workspace member.Other flags
--no-clippyto check manifests only,-D/--deny-warningsto fail on warnings too, and exit 1 on any error — suitable for CI. Missing toolchain pieces (clippy component, wasm32 target) are reported as findings carrying therustupcommand to run, rather than as a crash.Example
Testing
26 unit tests added — every fix applier is round-tripped through its own check, so
--fixprovably satisfies the lint it claims to fix.cargo test -p tari-ootle-cli: 44 passed. Clippy and fmt clean. Manually exercised against a scratch template crate for the report,--fix, and toolchain-failure paths.Docs: new
## lintsection indocs/03-reference/cli-commands.md.🤖 Generated with Claude Code