Coree.Analyzers.CodeClarity 0.1.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Coree.Analyzers.CodeClarity --version 0.1.4
                    
NuGet\Install-Package Coree.Analyzers.CodeClarity -Version 0.1.4
                    
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="Coree.Analyzers.CodeClarity" Version="0.1.4">
  <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="Coree.Analyzers.CodeClarity" Version="0.1.4" />
                    
Directory.Packages.props
<PackageReference Include="Coree.Analyzers.CodeClarity">
  <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 Coree.Analyzers.CodeClarity --version 0.1.4
                    
#r "nuget: Coree.Analyzers.CodeClarity, 0.1.4"
                    
#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 Coree.Analyzers.CodeClarity@0.1.4
                    
#: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=Coree.Analyzers.CodeClarity&version=0.1.4
                    
Install as a Cake Addin
#tool nuget:?package=Coree.Analyzers.CodeClarity&version=0.1.4
                    
Install as a Cake Tool

Coree.Analyzers.CodeClarity

NuGet Version NuGet Downloads Build Status Targets License

A return expression should stay directly readable. This package flags one that exceeds the allowed number of calculation steps.

dotnet add package Coree.Analyzers.CodeClarity

Example in a project file. The version 0.1.2 is the one shown here:

<ItemGroup>
  <PackageReference Include="Coree.Analyzers.CodeClarity" Version="0.1.2">
    <PrivateAssets>all</PrivateAssets>
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  </PackageReference>
</ItemGroup>

Diagnostics

Id What it flags
CCCRC001 A return expression whose calculation-step score exceeds ReturnTypeComplexityAnalyzerMaximum (default 1)

Arithmetic other than string concatenation, method calls other than nameof, and conditional operators each count as one step. Casts, signs, await, member access, and identifiers do not. Default severity is warning.

At the default maximum of 1, return a + b stays quiet, and so does return total. return a + b + c reports CCCRC001. total is a local; that return is only the name.

int OneStep(int a, int b)
{
    return a + b;
}

int TwoSteps(int a, int b, int c)
{
    return a + b + c;
}

int FromLocal(int a, int b, int c)
{
    int total = a + b + c;
    return total;
}

MSBuild properties

Set these on the consuming compile target. The shipped props make them compiler-visible. Severity: warning, error, message, or off. An empty, negative, or non-numeric maximum keeps the default of 1.

<PropertyGroup>
  <ReturnTypeComplexityAnalyzerSeverity>warning</ReturnTypeComplexityAnalyzerSeverity>
  <ReturnTypeComplexityAnalyzerMaximum>1</ReturnTypeComplexityAnalyzerMaximum>
</PropertyGroup>

Repository: https://github.com/carsten-riedel/Coree.Analyzers

License: MIT

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.22 105 10/28/2026
1.0.20 99 10/28/2026
1.0.16 97 10/26/2026
1.0.9 95 10/26/2026
1.0.5 95 10/25/2026
1.0.1 98 10/25/2026
0.1.24 90 10/25/2026
0.1.21 97 10/25/2026
0.1.9 113 10/10/2026
0.1.8 97 10/10/2026
0.1.7 96 10/10/2026
0.1.5 100 10/8/2026
0.1.4 100 10/7/2026

0.1 (2026-10-07)

- Initial release.
- CCCRC001 flags a return expression whose calculation-step score exceeds ReturnTypeComplexityAnalyzerMaximum (default 1).
- String concatenation and nameof do not count. One arithmetic operator, one method call, or one conditional is allowed at the default.
- Default severity is warning; set warning, error, message, or off.