A .NET solution that ships NetEvolve.Analyzer, a Roslyn analyzer and code-fix package enforcing
maintainability and usage conventions in C# codebases. It targets teams that want consistent file
organization (one type per file, namespace-matches-folder) and safer null-check idioms enforced
automatically at build time, with automatic fixes wherever a fix is unambiguous.
The solution is a single analyzer package plus its test suites. The analyzer assembly targets
netstandard2.0 so it loads in every Roslyn host (Visual Studio, MSBuild, the dotnet CLI) and ships
as a development-only dependency: no runtime assemblies are added to a consuming project.
Rules are organized by the standard Microsoft diagnostic
categories (Design,
Documentation, Globalization, Interoperability, Maintainability, Naming, Performance, Reliability,
Security, Style, Usage) and use the NE diagnostic prefix. Each shipped rule is documented under
docs/rules and, where a mechanical fix exists, comes with a code-fix provider.
- NetEvolve.Analyzer - Roslyn analyzers and code fixes for maintainability and usage rules, packaged as a NuGet analyzer.
- NetEvolve.Analyzer.Tests.Unit - Unit tests for individual analyzers, code fixes, and helpers.
- NetEvolve.Analyzer.Tests.Integration - Integration tests exercising the analyzers against real compilations.
- File organization rules - one type per file, namespace-matches-folder, single namespace per file
- Null-check idiom rules -
is null/is not nullpatterns instead of==/!=/is object - Code fixes for every rule where a safe, mechanical fix exists
- Configurable via standard MSBuild properties, with an opt-out switch for the file-organization rules
- Automatic exemption for single-file deployments (
PublishSingleFile=true) - Zero runtime dependencies added to consuming projects (development dependency only)
- .NET SDK 10.0 or higher
- Git for version control
- Visual Studio 2022 or Visual Studio Code (recommended)
-
Clone the repository:
git clone https://github.com/dailydevops/analyzer.git cd analyzer -
Restore dependencies:
dotnet restore
-
Build the solution:
dotnet build
-
Run tests to verify installation:
dotnet test
dotnet build# Run all tests
dotnet test
# Run a specific test project
dotnet test test/NetEvolve.Analyzer.Tests.Unit
dotnet test test/NetEvolve.Analyzer.Tests.Integration# Format code using CSharpier
csharpier format .src/ # Production code
└── NetEvolve.Analyzer/ # Roslyn analyzers, code fixes, and helpers, grouped by diagnostic category
test/ # Test projects
├── NetEvolve.Analyzer.Tests.Unit/ # Unit tests for analyzers, code fixes, and helpers
└── NetEvolve.Analyzer.Tests.Integration/ # Integration tests against real compilations
docs/
└── rules/ # One Markdown file per diagnostic (NE0001.md, NE0002.md, ...)Each rule lives under src/NetEvolve.Analyzer/<Category>/, matching the diagnostic category it
belongs to (for example Maintainability/ or Usage/). Diagnostic identifiers are registered
centrally in DiagnosticIds.cs, and MSBuild property keys read by rules are registered in
BuildProperty.cs. Where a rule can be fixed mechanically, a matching *CodeFixProvider sits next to
the analyzer, and batch fixes across a project share the generalized SequentialFixAllProvider.
Analyzer release tracking follows the standard Roslyn convention via
AnalyzerReleases.Shipped.md / AnalyzerReleases.Unshipped.md in the project.
We welcome contributions from the community! Please read our Contributing Guidelines before submitting a pull request.
Key points:
- Follow the Conventional Commits format for commit messages
- Write tests for new functionality
- Follow existing code style and conventions
- Update documentation as needed
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].
- Rule documentation - One page per diagnostic, with cause, rule description, fix guidance, and configuration
- Contributing Guidelines - How to contribute to this project
- Code of Conduct - Community standards and expectations
- License - Project licensing information
This project uses GitVersion for automated semantic versioning based on Git history and Conventional Commits. Version numbers are automatically calculated during the build process.
- Issues: Report bugs or request features on GitHub Issues
- Documentation: Read the full documentation in this repository
This project is licensed under the MIT License - see the LICENSE file for details.
Note
Made with ❤️ by the NetEvolve Team Visit us at https://www.daily-devops.net for more information about our services and solutions.