Our error messages have no casing convention, and it shows -- "Failed to X" sits right next to "failed to X", "Error" next to "error", split almost 50/50 across the tree. Let's adopt the Rust API Guidelines convention (C-GOOD-ERR) -- lowercase first word, no trailing period -- so an error's Display text composes cleanly when it gets wrapped into a larger chain, and add a build-time lint so it stays that way. This is the errors half; logging is a separate follow-up.
What this involves
- A
syn-based cargo xtask lint-error-messages check (stable Rust -- casing is purely syntactic, so unlike carbide-lints it needs no borrow-checker). It inspects the message literal in #[error(...)], anyhow!/bail!/eyre!/ensure!, .context()/.wrap_err(), and NicoError/Status constructors, and flags a first word that's a capitalized normal word, or a trailing period. --fix rewrites offenders in place.
- All-caps acronyms (
BMC, DHCP, DPU) are casing-neutral and stay; mixed-case proper nouns (Redfish, Vault) get lowercased like any other word. // xtask:allow-error-case on or above a line opts it out.
- Run
--fix across the tree -- ~900 messages in ~40 crates -- and update the tests that assert the old strings. Panics / expect / assert are out of scope (not Error Display, and already mostly lowercase).
- Wire it into the lint gate (
cargo make lint-error-messages + a CI step next to carbide-lints) and document the convention in STYLE_GUIDE.md.
Our error messages have no casing convention, and it shows --
"Failed to X"sits right next to"failed to X","Error"next to"error", split almost 50/50 across the tree. Let's adopt the Rust API Guidelines convention (C-GOOD-ERR) -- lowercase first word, no trailing period -- so an error'sDisplaytext composes cleanly when it gets wrapped into a larger chain, and add a build-time lint so it stays that way. This is the errors half; logging is a separate follow-up.What this involves
syn-basedcargo xtask lint-error-messagescheck (stable Rust -- casing is purely syntactic, so unlikecarbide-lintsit needs no borrow-checker). It inspects the message literal in#[error(...)],anyhow!/bail!/eyre!/ensure!,.context()/.wrap_err(), andNicoError/Statusconstructors, and flags a first word that's a capitalized normal word, or a trailing period.--fixrewrites offenders in place.BMC,DHCP,DPU) are casing-neutral and stay; mixed-case proper nouns (Redfish,Vault) get lowercased like any other word.// xtask:allow-error-caseon or above a line opts it out.--fixacross the tree -- ~900 messages in ~40 crates -- and update the tests that assert the old strings. Panics /expect/assertare out of scope (notErrorDisplay, and already mostly lowercase).cargo make lint-error-messages+ a CI step next tocarbide-lints) and document the convention inSTYLE_GUIDE.md.