repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

lint scopes

a9447e8fc1f69caee25e220d5cdb40a0a601e12e

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (12)

+73 / −26 text lines

Diff layout

.cargo/config.toml

Modified

+6 / −0 text lines

1111 # Core lint groups
1212 "-D", "clippy::all",
1313 "-D", "clippy::pedantic",
14 # High-signal rule: pedantic members kept only when they catch real
15 # bugs far more often than they cry wolf. Demoted after observed
16 # false-positive friction:
17 "-A", "clippy::module_name_repetitions",
18 "-A", "clippy::must_use_candidate",
19 "-A", "clippy::needless_pass_by_value",
1420 "-W", "clippy::nursery",
1521 "-D", "clippy::suspicious",
1622 "-D", "clippy::complexity",

.system/RULES.md

Modified

+1 / −0 text lines

3838## Build gates
4040- Zero warnings.
41- Lint scopes: production strict with a curated high-signal allow-list; tests relax assertions and pedantic; guest crates stay strict on their wasm target.
4142- clippy all/pedantic/perf/style/correctness enforced.
4243- No unwrap/expect/panic/todo/unimplemented in shipped library code.
4344- Tests may use unwrap/expect/panic.

smith-ai/src/models.rs

Modified

+0 / −1 text lines

264264#[cfg(test)]
265#[expect(clippy::unwrap_used, reason = "catalog tests assert on checked data")]
266265mod tests {
267266 use super::*;
268267 use smith::message::{Message, Role};

smith-ai/src/mux.rs

Modified

+0 / −1 text lines

166166#[cfg(test)]
167#[expect(clippy::unwrap_used, reason = "router tests script fault streams")]
168167mod tests {
169168 use super::*;
170169 use futures::StreamExt;

smith-ai/src/transport.rs

Modified

+0 / −1 text lines

499499#[cfg(test)]
500#[expect(clippy::unwrap_used, reason = "body builders assert on fixed requests")]
501500mod tests {
502501 use super::*;
503502 use smith::id::ToolCallId;

smith-cli/tests/auth_cli.rs

Modified

+0 / −1 text lines

11//! End-to-end credential store behavior through the `smith auth` CLI.
2#![expect(clippy::unwrap_used, reason = "CLI tests assert on outcomes")]
43use assert_cmd::Command;
54use std::path::PathBuf;

smith-cli/tests/selection_cli.rs

Modified

+0 / −1 text lines

11//! Provider selection and provenance behavior through the `smith` CLI.
33//! CLI tests assert on outcomes.
4#![expect(clippy::unwrap_used, reason = "CLI tests assert on outcomes")]
65use assert_cmd::Command;
76use predicates::prelude::PredicateBooleanExt;

smith-harness/src/runtime.rs

Modified

+0 / −4 text lines

196196#[cfg(test)]
197#[expect(
198 clippy::unwrap_used,
199 reason = "runtime tests assert on assembled agents"
200)]
201197mod tests {
202198 use super::*;
203199 use crate::mock_text_reply;

smith-harness/tests/http_effect.rs

Modified

+0 / −1 text lines

33//! Integration tests drive a real socket, a real executor, and the
44//! durable session store.
5#![expect(clippy::unwrap_used, reason = "integration tests assert on outcomes")]
76use smith_harness::runtime::{RuntimeConfig, RuntimeProvider, build_agent};
87use std::io::{Read, Write};

smith-harness/tests/wasm_host.rs

Modified

+0 / −3 text lines

11//! Wasm host lifecycle: validate, instantiate, declare, invoke, fuel.
3#![expect(clippy::unwrap_used, reason = "integration tests assert on outcomes")]
4#![expect(clippy::panic, reason = "integration tests assert on outcomes")]
5
63use smith_harness::wasm::{PluginEngine, PluginInstance};
85/// Build the echo artifact, returning its path.

smith-rpc/src/lib.rs

Modified

+0 / −1 text lines

339339#[cfg(test)]
340#[expect(clippy::unwrap_used, reason = "rpc tests assert on scripted lines")]
341340mod tests {
342341 use super::*;
343342 use futures::StreamExt;

xtask/src/main.rs

Modified

+66 / −12 text lines

203203fn cargo_clippy(extra: &[OsString]) -> ExitCode {
204 let args = scoped(
204 sequence(&[clippy_prod, clippy_tests, clippy_guests], extra)
205}
207/// Production targets carry the full strict gate.
208fn clippy_prod(extra: &[OsString]) -> ExitCode {
209 clippy_phase(&["--lib", "--bins"], &[], extra)
210}
212/// Test targets may assert, panic, and print: outcomes are the point.
213/// Pedantic relaxes too; correctness lints stay on so test quality is
214/// still policed.
215fn clippy_tests(extra: &[OsString]) -> ExitCode {
216 clippy_phase(
217 &["--tests"],
205218 &[
206 "clippy",
207 "--locked",
208 "--workspace",
209 "--all-targets",
210 "--all-features",
219 "-A",
220 "clippy::unwrap_used",
221 "-A",
222 "clippy::expect_used",
223 "-A",
224 "clippy::panic",
225 "-A",
226 "clippy::todo",
227 "-A",
228 "clippy::unimplemented",
229 "-A",
230 "clippy::print_stdout",
231 "-A",
232 "clippy::print_stderr",
233 "-A",
234 "clippy::dbg_macro",
235 "-A",
236 "clippy::pedantic",
211237 ],
212238 extra,
213 );
214 match Command::new("cargo")
215 .env("CLIPPY_CONF_DIR", ".config")
216 .args(&args)
217 .status()
218 {
239 )
240}
242/// Guest crates stay strict, cross-checked on their wasm target; the
243/// crate-level expectations on generated surfaces carry the exceptions.
244fn clippy_guests(extra: &[OsString]) -> ExitCode {
245 if extra.iter().any(|arg| arg == "-p" || arg == "--package") {
246 return ExitCode::SUCCESS;
247 }
248 clippy_phase(
249 &[
250 "-p",
251 "smith-plugin-echo",
252 "--target",
253 "wasm32-wasip2",
254 "--lib",
255 ],
256 &[],
257 extra,
258 )
259}
261fn clippy_phase(targets: &[&str], lint_args: &[&str], extra: &[OsString]) -> ExitCode {
262 let mut base = vec!["clippy", "--locked"];
263 base.extend_from_slice(targets);
264 base.push("--all-features");
265 let args = scoped(&base, extra);
266 let mut command = Command::new("cargo");
267 command.env("CLIPPY_CONF_DIR", ".config").args(&args);
268 if !lint_args.is_empty() {
269 command.arg("--");
270 command.args(lint_args);
271 }
272 match command.status() {
219273 Ok(status) if status.success() => ExitCode::SUCCESS,
220274 Ok(status) => fail(&format!("cargo clippy exited with {status}\n")),
221275 Err(error) => fail(&format!("failed to run cargo clippy: {error}\n")),