From 919f8b31f7ed5703899f1d5d431869cf6544cbd0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 15:50:19 +0000 Subject: [PATCH] docs: condense WS0001 rule documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove prose bloat in the Rule description and When to suppress sections: - Merge three paragraphs into two in Rule description - Simplify net8/net9 explanation to a single combined sentence - Condense Cause prose to one line - Tighten How to fix violations lead-in to one line - Reduce When to suppress description from two lines to one 63 → 50 lines (-20.6%), 281 → 229 words (-18.5%) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/rules/WS0001.md | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/docs/rules/WS0001.md b/docs/rules/WS0001.md index 2f5e017..ade2275 100644 --- a/docs/rules/WS0001.md +++ b/docs/rules/WS0001.md @@ -9,9 +9,7 @@ ## Cause -An extension method on `IWitness` logs through `witness.Logger` using one of the -templated `ILogger` extension methods (`LogTrace`, `LogDebug`, `LogInformation`, -`LogWarning`, `LogError`, `LogCritical`, or `Log`) with a constant message template. +An extension method on `IWitness` calls a templated `ILogger` extension method (`LogTrace`, `LogDebug`, `LogInformation`, `LogWarning`, `LogError`, `LogCritical`, or `Log`) with a constant message template. ```csharp public static void LogOrderPlaced(this IWitness witness, int orderId) @@ -22,22 +20,13 @@ public static void LogOrderPlaced(this IWitness witness, int order ## Rule description -The templated `ILogger` extension methods box value-type arguments and parse the -message template on every call. The source-generated `[LoggerMessage]` pattern avoids -both costs, producing allocation-free, strongly-typed logging. +The templated `ILogger` extension methods box value-type arguments and parse the message template on every call. `[LoggerMessage]` avoids both costs, producing allocation-free, strongly-typed logging. -On **net9.0** and later, WitnessSharp ships a source-generator interceptor that rewrites -these call sites to `[LoggerMessage]`-equivalent code automatically — you do not need to -change anything, and this diagnostic is informational only. - -On **net8.0**, no interception occurs. This analyzer surfaces the optimization -opportunity and the accompanying code fix converts the call site to an explicit -`[LoggerMessage]` partial method. +On **net9.0+**, WitnessSharp's source-generator interceptor rewrites these call sites automatically — this diagnostic is informational only. On **net8.0**, no interception occurs; the analyzer surfaces the optimization and the code fix applies it. ## How to fix violations -Apply the **"Convert to [LoggerMessage] pattern"** code fix, or manually extract the log -call into a `[LoggerMessage]` partial method: +Apply the **"Convert to [LoggerMessage] pattern"** code fix, or manually rewrite as a `[LoggerMessage]` partial method: ```csharp public static partial class OrderServiceLog @@ -52,9 +41,7 @@ public static partial class OrderServiceLog ## When to suppress -This rule is informational and safe to suppress when the performance of a particular log -statement is irrelevant (for example, rarely executed startup diagnostics). Suppress it -with: +Suppress when a log statement's performance is irrelevant (e.g., rare startup diagnostics): ```csharp #pragma warning disable WS0001