ExxerRules.Analyzers
1.0.0
dotnet add package ExxerRules.Analyzers --version 1.0.0
NuGet\Install-Package ExxerRules.Analyzers -Version 1.0.0
<PackageReference Include="ExxerRules.Analyzers" Version="1.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="ExxerRules.Analyzers" Version="1.0.0" />
<PackageReference Include="ExxerRules.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add ExxerRules.Analyzers --version 1.0.0
#r "nuget: ExxerRules.Analyzers, 1.0.0"
#:package ExxerRules.Analyzers@1.0.0
#addin nuget:?package=ExxerRules.Analyzers&version=1.0.0
#tool nuget:?package=ExxerRules.Analyzers&version=1.0.0
ExxerRules - Modern Development Conventions Analyzers
Comprehensive Roslyn analyzer suite enforcing Modern Development Conventions (MDC) with 20 production-ready analyzers.
๐ฏ What is ExxerRules?
ExxerRules is a comprehensive suite of Roslyn analyzers that automatically enforce Modern Development Conventions (MDC) in your C# codebase. Built using rigorous Test-Driven Development with 51/51 tests passing (100% success rate), it covers everything from Clean Architecture boundaries to functional programming patterns.
โก Quick Start
Installation
<PackageReference Include="ExxerRules.Analyzers" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Immediate Benefits
- โ Automatic code quality enforcement - No more manual code reviews for standards
- โ Clean Architecture validation - Prevent architectural violations at build time
- โ Functional programming patterns - Enforce Result<T> instead of exceptions
- โ Modern testing standards - XUnit v3, Shouldly, NSubstitute enforcement
- โ Performance optimization - ConfigureAwait, efficient LINQ patterns
- โ Zero configuration - Works out of the box with sensible defaults
๐ Complete Analyzer Coverage
๐งช Testing Standards (5 analyzers)
ID | Analyzer | Description |
---|---|---|
EXXER100 | TestNamingConvention | Enforce Should_Action_When_Condition naming |
EXXER101 | UseXUnitV3 | Upgrade from XUnit v2 to v3 |
EXXER102 | UseShouldly | Use Shouldly instead of FluentAssertions |
EXXER103 | UseNSubstitute | Use NSubstitute instead of Moq |
EXXER104 | DoNotMockDbContext | Use InMemory provider instead of mocking EF |
โก Functional Patterns (1 analyzer)
ID | Analyzer | Description |
---|---|---|
EXXER003 | DoNotThrowExceptions | Use Result<T> pattern instead of exceptions |
๐ก๏ธ Null Safety (1 analyzer)
ID | Analyzer | Description |
---|---|---|
EXXER200 | ValidateNullParameters | Validate null parameters at method entry |
๐ Async Best Practices (2 analyzers)
ID | Analyzer | Description |
---|---|---|
EXXER300 | AcceptCancellationToken | Async methods should accept CancellationToken |
EXXER301 | UseConfigureAwaitFalse | Use ConfigureAwait(false) in library code |
๐ Documentation (1 analyzer)
ID | Analyzer | Description |
---|---|---|
EXXER400 | RequireXmlDocumentation | Public members should have XML documentation |
โจ Code Quality (4 analyzers)
ID | Analyzer | Description |
---|---|---|
EXXER500 | AvoidMagicNumbers | Use named constants instead of magic numbers |
EXXER501 | UseExpressionBodies | Use expression-bodied members where appropriate |
EXXER503 | DoNotUseRegions | Prefer sub-classes instead of regions |
EXXER702 | UseModernPatternMatching | Use declaration patterns (if (x is string s) ) |
๐๏ธ Architecture (2 analyzers)
ID | Analyzer | Description |
---|---|---|
EXXER600 | DomainNoInfrastructure | Domain layer should not reference Infrastructure |
EXXER601 | UseRepositoryPattern | Use Repository pattern with focused interfaces |
๐ Performance (2 analyzers)
ID | Analyzer | Description |
---|---|---|
EXXER700 | UseEfficientLinq | Avoid multiple enumerations, use efficient patterns |
EXXER301 | UseConfigureAwaitFalse | (Covered in Async section) |
๐ Logging (2 analyzers)
ID | Analyzer | Description |
---|---|---|
EXXER800 | UseStructuredLogging | Use structured logging with parameters |
EXXER801 | DoNotUseConsoleWriteLine | Use proper logging instead of Console.WriteLine |
๐จ Code Examples
โ Before ExxerRules
// EXXER003: Throwing exceptions
public string ProcessData(string input)
{
if (string.IsNullOrEmpty(input))
throw new ArgumentException("Input cannot be null"); // โ Exception
return input.ToUpper();
}
// EXXER600: Architecture violation
using MyApp.Infrastructure.Data; // โ Domain referencing Infrastructure
namespace MyApp.Domain.Services
{
public class OrderService
{
private readonly DbContext _context; // โ Direct DbContext usage
}
}
// EXXER102: Wrong testing framework
[Fact]
public void TestMethod()
{
result.Should().Be("expected"); // โ FluentAssertions
}
โ After ExxerRules
// โ
Result<T> pattern
public Result<string> ProcessData(string input)
{
if (string.IsNullOrEmpty(input))
return Result.Fail("Input cannot be null"); // โ
Result<T>
return Result.Ok(input.ToUpper());
}
// โ
Clean Architecture
using MyApp.Domain.Interfaces; // โ
Domain referencing abstractions
namespace MyApp.Domain.Services
{
public class OrderService
{
private readonly IOrderRepository _repository; // โ
Repository pattern
}
}
// โ
Shouldly assertions
[Fact]
public void Should_ReturnExpectedValue_When_ValidInput()
{
result.ShouldBe("expected"); // โ
Shouldly
}
๐ง Configuration
EditorConfig Integration
# Enable all ExxerRules analyzers
[*.cs]
dotnet_analyzer_diagnostic.EXXER003.severity = error # Result<T> pattern (critical)
dotnet_analyzer_diagnostic.EXXER600.severity = error # Clean Architecture (critical)
dotnet_analyzer_diagnostic.EXXER100.severity = warning # Test naming
dotnet_analyzer_diagnostic.EXXER501.severity = suggestion # Expression bodies
MSBuild Configuration
<PropertyGroup>
<WarningsAsErrors>EXXER003;EXXER600;EXXER601</WarningsAsErrors>
<EXXER003>error</EXXER003>
<EXXER600>error</EXXER600>
<EXXER700>warning</EXXER700>
</PropertyGroup>
๐ข Enterprise Features
Clean Architecture Enforcement
- โ Domain layer isolation
- โ Dependency direction validation
- โ Repository pattern compliance
- โ Infrastructure abstraction
Functional Programming Support
- โ Result<T> pattern enforcement
- โ Exception-free error handling
- โ Composable error flows
- โ Railway-oriented programming
Modern Testing Standards
- โ XUnit v3 migration path
- โ Shouldly assertion consistency
- โ NSubstitute mocking standards
- โ Test naming conventions
- โ EF Core testing best practices
Performance Optimization
- โ Async/await best practices
- โ LINQ efficiency patterns
- โ ConfigureAwait compliance
- โ Memory allocation awareness
๐ Benefits for Your Team
Benefit | Before ExxerRules | After ExxerRules |
---|---|---|
Code Reviews | Manual standards checking | Automated enforcement |
Architecture | Violations slip through | Caught at compile time |
Testing | Inconsistent frameworks | Unified modern standards |
Performance | Runtime discovery | Build-time detection |
Onboarding | Weeks to learn standards | Immediate guidance |
Technical Debt | Accumulates over time | Prevented automatically |
๐ Advanced Usage
Custom Rule Sets
<ItemGroup>
<AdditionalFiles Include="exxer.ruleset" />
</ItemGroup>
CI/CD Integration
- name: Build with ExxerRules
run: |
dotnet build --configuration Release \
--verbosity normal \
--property WarningsAsErrors="EXXER003;EXXER600"
Team Customization
<PropertyGroup>
<EnableExxerRules>true</EnableExxerRules>
<EnableArchitectureRules Condition="'$(ProjectType)' == 'Domain'">true</EnableArchitectureRules>
<EnableTestingRules Condition="'$(ProjectType)' == 'Tests'">true</EnableTestingRules>
</PropertyGroup>
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Principles
- โ Test-Driven Development - All analyzers developed with TDD (51/51 tests passing)
- โ Clean Code - Follow the same standards we enforce
- โ Performance First - Minimal analyzer overhead
- โ Developer Experience - Clear diagnostic messages and actionable suggestions
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฏ Support
- ๐ Documentation: docs.exxerai.com/exxer-rules
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ง Enterprise Support: enterprise@exxerai.com
Made with โค๏ธ by the ExxerAI team using Test-Driven Development
"Clean code is not written by following a set of rules. Clean code is written by professionals who care about their craft." - Robert C. Martin
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.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 163 | 8/8/2025 |
v1.0.0: Initial release with 20 comprehensive analyzers
- Testing Standards (5): XUnit v3, Shouldly, NSubstitute, DbContext patterns, naming conventions
- Functional Patterns (1): Result<T> pattern enforcement (no exceptions)
- Null Safety (1): Parameter validation
- Async Best Practices (2): CancellationToken support, ConfigureAwait(false)
- Documentation (1): XML documentation requirements
- Code Quality (4): Magic numbers/strings, expression bodies, no regions, pattern matching
- Architecture (2): Clean Architecture boundaries, Repository patterns
- Performance (2): Efficient LINQ, ConfigureAwait patterns
- Logging (2): Structured logging, no Console.WriteLine
All analyzers developed using Test-Driven Development with 51/51 tests passing (100% success rate).