NetEvolve.Analyzer
0.7.1
Prefix Reserved
See the version list below for details.
dotnet add package NetEvolve.Analyzer --version 0.7.1
NuGet\Install-Package NetEvolve.Analyzer -Version 0.7.1
<PackageReference Include="NetEvolve.Analyzer" Version="0.7.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="NetEvolve.Analyzer" Version="0.7.1" />
<PackageReference Include="NetEvolve.Analyzer"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add NetEvolve.Analyzer --version 0.7.1
#r "nuget: NetEvolve.Analyzer, 0.7.1"
#:package NetEvolve.Analyzer@0.7.1
#addin nuget:?package=NetEvolve.Analyzer&version=0.7.1
#tool nuget:?package=NetEvolve.Analyzer&version=0.7.1
NetEvolve.Analyzer
Roslyn analyzers and code fixes for .NET, organized by the standard Microsoft diagnostic categories. It enforces consistent file organization and safer null-check idioms in C# code, with an automatic fix offered for every rule that has one.
Features
- File organization - one type per file, namespace matches folder structure, single namespace per file
- Null-check idioms -
is null/is not nullpatterns instead of== null,!= null, oris object - Code fixes - a fix is registered for every rule, gated to the language version it requires
- Batch fixes - a shared sequential Fix-All provider applies fixes across a document, project, or solution
- Configurable - MSBuild properties tune or fully disable the file-organization rules
- Zero footprint - a development dependency only; no runtime assembly is added to your project
Installation
NuGet Package Manager
Install-Package NetEvolve.Analyzer
.NET CLI
dotnet add package NetEvolve.Analyzer
PackageReference
<PackageReference Include="NetEvolve.Analyzer" Version="x.x.x" PrivateAssets="all" />
The package ships only the analyzer assembly under analyzers/dotnet/cs and adds no runtime
dependencies to your project; PrivateAssets="all" keeps it from flowing to your own package
consumers.
Quick Start
No code changes are required. Once the package reference is added, the analyzers run on every build
and report diagnostics under the NE prefix, for example:
warning NE0004: Use the 'is null' pattern instead of '== null'
Apply the offered code fix in your editor, or fix every occurrence at once with dotnet format:
dotnet format analyzers --diagnostics NE0004
Usage
Basic example
Given:
if (value == null)
{
return;
}
NE0004 reports the comparison and offers a code fix that rewrites it to:
if (value is null)
{
return;
}
File organization example
NE0001 and NE0002 keep a file's name and namespace aligned with its type and folder. A file at
Shapes/Circle.cs declaring namespace Geometry.Polygons; is flagged by NE0002 with a fix that
rewrites the namespace to Geometry.Shapes (the folder-derived value, anchored at RootNamespace).
Configuration
All configuration is done through standard MSBuild properties in your project file — no .editorconfig
entries are required.
<PropertyGroup>
<NetEvolveAnalyzerGroupGenericOverloads>true</NetEvolveAnalyzerGroupGenericOverloads>
<NetEvolveAnalyzerDisableFileOrganizationRules>true</NetEvolveAnalyzerDisableFileOrganizationRules>
</PropertyGroup>
The file-organization rules are also disabled automatically for single-file deployments
(PublishSingleFile=true).
To suppress an individual diagnostic instead:
#pragma warning disable NE0001
#pragma warning restore NE0001
Diagnostics
Every rule uses the NE identifier prefix and is documented under
docs/rules, with its cause, rule
description, fix guidance, and configuration options.
| Rule | Category | Description | Code fix |
|---|---|---|---|
| NE0001 | Maintainability | Declare one type per file with a matching file name | Yes |
| NE0002 | Maintainability | Namespace should match the folder structure | Yes |
| NE0003 | Maintainability | Declare a single namespace per file | Yes |
| NE0004 | Usage | Use the is null pattern instead of == null |
Yes |
| NE0005 | Usage | Use the is not null pattern instead of != null |
Yes |
| NE0006 | Usage | Use the is not null pattern instead of is object |
Yes |
See AnalyzerReleases.Shipped.md for the list of rules included in the
current release, and AnalyzerReleases.Unshipped.md for rules staged
for the next one.
Requirements
- A project compiling with a Roslyn-based compiler (any currently supported .NET SDK)
- No target-framework restriction on the consuming project — the analyzer runs against the compiler, not your project's target framework
Documentation
For the full solution documentation, see the repository README.
Contributing
Contributions are welcome! Please read the Contributing Guidelines before submitting a pull request.
Support
- Issues: Report bugs or request features on GitHub Issues
- Documentation: Read the full documentation at https://github.com/dailydevops/analyzer
License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the NetEvolve Team Visit us at https://www.daily-devops.net for more information about our services and solutions.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.