ExxerRules.Analyzers 1.0.0

dotnet add package ExxerRules.Analyzers --version 1.0.0
                    
NuGet\Install-Package ExxerRules.Analyzers -Version 1.0.0
                    
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="ExxerRules.Analyzers" Version="1.0.0">
  <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="ExxerRules.Analyzers" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ExxerRules.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 ExxerRules.Analyzers --version 1.0.0
                    
#r "nuget: ExxerRules.Analyzers, 1.0.0"
                    
#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 ExxerRules.Analyzers@1.0.0
                    
#: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=ExxerRules.Analyzers&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ExxerRules.Analyzers&version=1.0.0
                    
Install as a Cake Tool

ExxerRules - Modern Development Conventions Analyzers

NuGet version Build Status Test Status TDD Coverage

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


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

There are no supported framework assets in this package.

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).