Skip to content

feat: add tari lint command - #191

Merged
sdbondi merged 3 commits into
mainfrom
feat/lint-command
Aug 20, 2026
Merged

feat: add tari lint command#191
sdbondi merged 3 commits into
mainfrom
feat/lint-command

Conversation

@sdbondi

@sdbondi sdbondi commented Aug 20, 2026

Copy link
Copy Markdown
Member

Adds tari lint (aliases lints, 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

Code Severity What
rust::clippy error / warning Runs cargo clippy --target wasm32-unknown-unknown, renders its diagnostics inline
cargo::crate-type error / warning [lib] crate-type must be exactly ["cdylib"]; missing or non-cdylib is an error, extras like rlib a warning (each extra type is compiled and linked in)
cargo::release-profile warning opt-level/lto/codegen-units/panic/strip, listing only the keys actually missing
cargo::test-runtime-profile suggestion Dev opt-level for the six wasmer/cranelift crates, without which template tests run ~10x slower. Only checked when the crate has tests
template::metadata warning / suggestion description + [package.metadata.tari-template] fields, suggesting the exact tari template init -y --… invocation
template::metadata-build warning tari_ootle_template_build build-dep and a build.rs calling TemplateMetadataBuilder

--fix

Applies everything that does not need the author's input: clippy's machine-applicable suggestions (cargo clippy --fix --allow-dirty), both profile sections, crate-type, and init_metadata::auto_init for the build script. template::metadata is deliberately not auto-fixable — only the author knows the values — and a build.rs that exists but does something unrelated is never rewritten.

Cargo only honours [profile.*] in the workspace root manifest, so profile checks read (and --fix writes) that manifest when the template is a workspace member.

Other flags

--no-clippy to check manifests only, -D/--deny-warnings to 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 the rustup command to run, rather than as a crash.

Example

⚠️ warning[cargo::crate-type]: `crate-type` also contains `rlib` — every extra crate type is
   compiled and linked in, bloating the published binary
   --> Cargo.toml [lib]
   help:
       In Cargo.toml, keep only the dynamic library:

       [lib]
       crate-type = ["cdylib"]
   (fixable with `tari lint --fix`)

Summary: 0 error(s), 1 warning(s), 0 suggestion(s)
Run `tari lint --fix` to apply the fixes marked above.

Testing

26 unit tests added — every fix applier is round-tripped through its own check, so --fix provably 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 ## lint section in docs/03-reference/cli-commands.md.

🤖 Generated with Claude Code

sdbondi and others added 3 commits August 20, 2026 15:39
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>
@sdbondi
sdbondi merged commit 43de77f into main Aug 20, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant