From ce87df4a04578bebd2d02cfbb0d7adcb785dc95f Mon Sep 17 00:00:00 2001 From: KaliCZ Date: Thu, 16 Jul 2026 23:30:25 +0200 Subject: [PATCH] Docs: brace multi-line bodies; state the exhaustive-switch rule generally Brace a loop/conditional body unless it's a true one-liner. And state the no-default-arm switch rule generally in Naming and style (it was only in the error-mapping rule 5, though .editorconfig already enforces it via CS8509=error). Co-Authored-By: Claude Opus 4.8 --- CLAUDE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 37cb8a4..ad51da3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -111,6 +111,13 @@ restart the AppHost. functions; extract a private method instead. A one-liner local function can occasionally be acceptable, but that's an edge case, not something to aim for. +- Brace a loop or conditional body unless it's a true one-liner; a body that + spans multiple lines (a multi-line call, an object initializer) takes braces + even as a single statement, and a long method braces even its one-liners. +- No `default`/discard arm in a `switch` over an enum or a type we own — an + exhaustive expression lets the compiler break the build on a new value + (`CS8509` is an error; see rule 5 and [.editorconfig](.editorconfig)); a + `default` is only for open input we don't control. - Comments only for a non-obvious *why*, one sentence; when in doubt, none. - Correctness analyzer rules are build errors (see [.editorconfig](.editorconfig)); style rules are suggestions. `TreatWarningsAsErrors` is on.