Skip to content
Wakemeup edited this page Jul 21, 2026 · 4 revisions

HooSharper Wiki

HooSharper provides conservative Roslyn analyzers and automatic code fixes for common C# code-style transformations.

Rules

ID Rule Summary
HOO1001 Prefer an early return Replace a final nested condition in a void method with a guard clause.
HOO1002 Omit braces for a single-statement if Remove braces from safe one-statement if and else branches.
HOO1003 Remove a redundant else Flatten an else after a branch that definitely terminates.
HOO1004 Prefer an early continue Replace a final nested loop condition with a continue guard.
HOO1005 Use a type pattern Combine an as cast and null check into a declaration pattern.
HOO1006 Simplify boolean comparison Remove comparisons between bool expressions and literals.
HOO1007 Use TryGetValue Combine ContainsKey and index access into TryGetValue.
HOO1008 Use a null-coalescing assignment Replace a null guard and assignment with ??=.
HOO1009 Use ArgumentNullException.ThrowIfNull Modernize classic argument-null guards.
HOO1010 Merge nested if statements Combine nested boolean conditions without else branches.
HOO1011 Use Dictionary.TryAdd Combine dictionary existence testing and insertion.
HOO1012 Use the HashSet.Add result Avoid a separate set membership lookup.
HOO1013 Use a using declaration Flatten a terminal using statement without changing disposal timing.
HOO1014 Use a null-coalescing expression Replace a conditional null fallback with ??.
HOO1015 Use null-conditional access Replace a conditional member access with ?..
HOO1016 Use string.Contains Express string presence tests directly.
HOO1017 Simplify boolean return Return a boolean condition directly.
HOO1018 Remove a redundant null-conditional guard Remove a null guard already enforced by ?..
HOO1019 Use a not pattern Move logical negation into an is not pattern.
HOO1020 Wrap long fluent chains Wrap chains beyond 140 characters with leading dots.

All rules use category HooSharper.CodeStyle, default to Info severity, are enabled by default, and provide Fix All support.

Clone this wiki locally