Dloizides.Analyzers 0.8.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dloizides.Analyzers --version 0.8.2
                    
NuGet\Install-Package Dloizides.Analyzers -Version 0.8.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dloizides.Analyzers" Version="0.8.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dloizides.Analyzers" Version="0.8.2" />
                    
Directory.Packages.props
<PackageReference Include="Dloizides.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dloizides.Analyzers --version 0.8.2
                    
#r "nuget: Dloizides.Analyzers, 0.8.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Dloizides.Analyzers@0.8.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dloizides.Analyzers&version=0.8.2
                    
Install as a Cake Addin
#tool nuget:?package=Dloizides.Analyzers&version=0.8.2
                    
Install as a Cake Tool

Dloizides.Analyzers

Roslyn analyzers for the house comment standard (no comments in code, and only short doc comments on public members) and the test-name standard (Method_Scenario_Expected) and feature folders over technical-type folders. Business and logic intent lives in names and in unit / integration test names.

Id Reports
DLZ0001 A // or /* */ comment that is not a tool directive (#pragma, ReSharper, <auto-generated>)
DLZ0002 A doc comment (/// or /** */) on a member not visible outside the assembly: private, internal, private protected, a member of a non-public type, a local function, or a statement
DLZ0003 A doc comment over 3 content lines, a summary over one line, a line over 120 characters, a call chain (→, -> or a line starting Flow:), or using an element other than <summary>, <param>, <returns>, <inheritdoc/> and inline <see>, <c>, <paramref>, <typeparamref>
DLZ0004 A [Fact], [Theory], [Test] or [TestMethod] method (or an attribute derived from one) not named Method_Scenario_Expected: exactly 3 PascalCase parts, the Scenario starting With, When, Without or Given (Create_WithValidRequest_Returns201)
DLZ0005 A type declared in a namespace with a Services, Helpers, Utils, Utilities or Common segment: organize by feature/use case (ARCH-VSA-1 "Vertical Slice Architecture inside Clean Architecture"). Runs only when HouseArchitectureStyle is CleanVerticalSlice; skipped in assemblies ending .Shared, .SharedKernel or Tests; one diagnostic per top-level type

Pattern rules

Default severity error, category Dloizides.Patterns (PATTERN-1 "Use the house pattern wherever its trigger appears"). Rules 6, 7 and 9 skip assemblies ending Tests.

Id Reports
DLZ0006 new HttpClient(...) outside a lambda passed to AddHttpClient, ConfigureHttpClient, ConfigurePrimaryHttpMessageHandler or AddTypedClient (PAT-HTTP-1)
DLZ0007 IConfiguration (or a type implementing it) as a constructor or primary-constructor parameter, or a field of a type whose constructors do not take it; static classes, Startup and Program are skipped (PAT-CONFIG-1)
DLZ0008 An if or ?: whose condition is only role checks (IsInRole, Contains/Any on a *Roles value) and whose branch calls Forbid/ForbidAsync/ForbiddenAsync/SendForbiddenAsync or creates a ForbidResult; a condition that also checks ownership is not reported (PAT-AUTHZ-1)
DLZ0009 GetOrAdd/TryAdd/AddOrUpdate/TryUpdate or an indexer write on a static ConcurrentDictionary outside its field initializer or static constructor (PAT-CACHE-1)
DLZ0010 A [SuppressMessage] / [UnconditionalSuppressMessage] for DLZ0006-DLZ0009 with a missing, empty or blank Justification
DLZ0011 A project whose MSBuild property HouseArchitectureStyle is missing, empty or not Clean / CleanVerticalSlice (case-sensitive); one diagnostic per compilation (PAT-STYLE-1)

Lone <summary> / </summary> lines and <inheritdoc/> do not count toward the 3-line cap. Generated code (<auto-generated>, *.g.cs, *.Designer.cs, generated_code = true) and files under a Migrations folder are skipped. Works with and without GenerateDocumentationFile.

Adopt

<PackageReference Include="Dloizides.Analyzers" Version="0.6.0" PrivateAssets="all" />

Put it in the repo's Directory.Build.props with the service's declared architecture style (D-PAT-10 "Architecture style is a per-service choice"): Clean = Clean Architecture layers only, CleanVerticalSlice = Clean layers plus feature folders (turns on DLZ0005). The package's buildTransitive props make the property visible to the analyzers.

<PropertyGroup>
  <HouseArchitectureStyle>CleanVerticalSlice</HouseArchitectureStyle>
</PropertyGroup>

Diagnostics default to warning; once the repo's comment cleanup has landed, make them errors in .editorconfig (a project that legitimately keeps a technical-type namespace sets dotnet_diagnostic.DLZ0005.severity = none):

[*.cs]
dotnet_diagnostic.DLZ0001.severity = error
dotnet_diagnostic.DLZ0002.severity = error
dotnet_diagnostic.DLZ0003.severity = error
dotnet_diagnostic.DLZ0004.severity = error
dotnet_diagnostic.DLZ0005.severity = error

Build and test

dotnet test tests/Dloizides.Analyzers.Tests

Publish with ./publish.ps1 -Bump patch -ApiKey $env:NUGET_API_KEY from a clean, committed tree.

Rule packs and DLZ0012-DLZ0013 (D-PAT-12 "Whole rule packs as warnings, one shared approach")

Referencing this package also brings Meziantou.Analyzer, Microsoft.VisualStudio.Threading.Analyzers and SonarAnalyzer.CSharp. buildTransitive/Dloizides.Analyzers.packs.globalconfig sets every default-enabled Info or Error rule of the packs to warning and turns MA0004 (ConfigureAwait: ASP.NET Core has no SynchronizationContext) and MA0048 (file name = type name: a vertical-slice file holds Request + Endpoint + Validator) off (global_level = 50: above the packs own configs, below a repo .globalconfig at 100; a repo .editorconfig always wins). buildTransitive/Dloizides.Analyzers.targets adds that file to EditorConfigFiles in a target before CoreCompile (a static GlobalAnalyzerConfigFiles item never reached the compiler) and appends every pack rule ID plus DLZ0001-DLZ0005, DLZ0012 and DLZ0013 to WarningsNotAsErrors, so a TreatWarningsAsErrors repo still builds; the warnings are counted by the ratchet, not held to zero. PackRuleFilesTests fails when a pack bump changes the rule list and names the regenerated file to copy in.

ID Rule
DLZ0012 A class named *Dto, *Command or *Event that derives from object is a record (PAT-REVIEW-7)
DLZ0013 A concrete *Service/*Repository/*Handler/*Provider/*Manager/*Client of the same solution is not constructed with new outside Program.cs/Startup.cs, a method taking IServiceCollection/IServiceProvider/a host builder, a lambda passed to Add*/TryAdd*/Configure*, or the type's own factory (PAT-REVIEW-4)

DLZ0014 (REVIEW-THREADS-1 C4 "Routes are RESTful (resource noun + HTTP verb), test fixtures included")

DLZ0014 (warning, listed in WarningsNotAsErrors) reports a string-literal route template whose path segment is named after an action. It reads the first positional argument of [Route], [HttpGet], [HttpPost], [HttpPut], [HttpDelete], [HttpPatch], and every string argument of Get, Post, Put, Delete, Patch, Routes called inside a method named Configure (FastEndpoints). Test projects are not exempt: a fixture route is a route.

Each segment's leading token is checked: the segment up to the first -, _, . or upper-case letter, lower-cased. {param} segments are skipped. A segment equal to [action] (any case) is always flagged: the MVC method name becomes the path.

Action words: get, add, list, search, save, send, edit, set, run, create, update, delete, remove, fetch, insert, execute, calculate. A leading token that starts with one is flagged (get, getall, getbyid, sendemail, addclaim, createwithclaims, update-status, sendMessage) unless:

Exception Examples not flagged
the rest is a noun ending: s, r, rs, er, ers, es, ion, ions, or, ors, al, ing, ings updates, fetcher, fetchers, inserts, lists
the rest is a participle d/ed, alone or followed by by, on, at, date, time, from, to createdby, createdon, updatedat, added
the token starts with a noun: setting, setpoint, setup, settle, address, listing, listen, runtime, runner, editor, edition settings, setpoints, setup, settlements, address, addresses, listings, runtime-switch

Tokens that do not start with an action word pass: deletion(s), insertion, calculator, executions, v1, {id:guid}. Residue: a verb that is not the leading token (bulk-delete) is not seen; a run-on noun missing from the list (sendgrid, getaway) is flagged and needs a justified suppression. Constants, interpolated strings and minimal-API Map* calls are not read.

Measured before shipping (2026-10-26, grep estimate with the same word rules): 3 hits across the SaaS backend services, 2 in PROOViD AMLService. Hence warning, not error; consumers keep a frozen baseline and burn it down.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.23.1 79 11/26/2026
0.23.0 74 11/26/2026
0.22.0 86 11/25/2026
0.21.0 83 11/25/2026
0.20.0 82 11/25/2026
0.19.0 78 11/25/2026
0.18.0 81 11/25/2026
0.14.0 91 11/23/2026
0.13.0 99 11/23/2026
0.12.0 114 11/21/2026
0.11.0 108 11/19/2026
0.10.1 270 11/19/2026
0.10.0 99 11/19/2026
0.9.0 132 10/27/2026
0.8.2 112 10/26/2026
0.8.1 102 10/26/2026
0.8.0 107 10/26/2026
0.7.4 373 10/19/2026
0.7.3 95 10/19/2026
0.7.2 98 10/19/2026
Loading failed