Coree.Analyzers.CodeClarity
0.1.7
See the version list below for details.
dotnet add package Coree.Analyzers.CodeClarity --version 0.1.7
NuGet\Install-Package Coree.Analyzers.CodeClarity -Version 0.1.7
<PackageReference Include="Coree.Analyzers.CodeClarity" Version="0.1.7"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Coree.Analyzers.CodeClarity" Version="0.1.7" />
<PackageReference Include="Coree.Analyzers.CodeClarity"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Coree.Analyzers.CodeClarity --version 0.1.7
#r "nuget: Coree.Analyzers.CodeClarity, 0.1.7"
#:package Coree.Analyzers.CodeClarity@0.1.7
#addin nuget:?package=Coree.Analyzers.CodeClarity&version=0.1.7
#tool nuget:?package=Coree.Analyzers.CodeClarity&version=0.1.7
Coree.Analyzers.CodeClarity
A return expression should stay directly readable. This package flags one that exceeds the allowed number of calculation steps. A parameter list has two shapes: the whole list on one line, parentheses included, or each parameter on its own line with the closing parenthesis on the following line.
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) |
| CCCPL001 | A parameter list that is neither entirely on one line, parentheses included, nor one parameter per line with the closing parenthesis on the following line |
| CCCPL002 | A parameter list that is broken across lines even though the parameters fit in ParameterListFitAnalyzerMaximum characters (default 120) |
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;
}
CCCPL001 looks at methods, local functions, constructors, and primary constructors of classes, structs, and records. Calls, indexers, delegates, and lambdas stay out of it. An empty list and a single parameter stay quiet. The first two samples report CCCPL001. The other two do not: one line, parentheses included, or one parameter per line with the closing parenthesis on the following line.
public void M(
float a,
float b,
float c)
public void M(
float a, float b, float c)
public record TerrainProfile(float Amplitude, float FrequencyX, float FrequencyZ, float DetailAmplitude, float DetailX, float DetailZ);
public void M(
float a,
float b,
float c
)
CCCPL002 is separate from that shape rule. The last sample stays within CCCPL001 and still reports CCCPL002, because the parameters would fit on one line. The length is the parameters joined by , after tabs, line breaks, and repeated spaces collapse. Parentheses are not counted. float a, float b, float c is 25 characters, so it reports at the default of 120. The one-line record does not. A longer list that uses the same legal break stays quiet.
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 that analyzer's default: 1 calculation step, or 120 characters for CCCPL002.
<PropertyGroup>
<ReturnTypeComplexityAnalyzerSeverity>warning</ReturnTypeComplexityAnalyzerSeverity>
<ReturnTypeComplexityAnalyzerMaximum>1</ReturnTypeComplexityAnalyzerMaximum>
<ParameterListLayoutAnalyzerSeverity>warning</ParameterListLayoutAnalyzerSeverity>
<ParameterListFitAnalyzerSeverity>warning</ParameterListFitAnalyzerSeverity>
<ParameterListFitAnalyzerMaximum>120</ParameterListFitAnalyzerMaximum>
</PropertyGroup>
Repository: https://github.com/carsten-riedel/Coree.Analyzers
License: MIT
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.
0.1.5 (2026-10-08)
- CCCPL001 flags a parameter list that spans more than one line while one of those lines still starts more than one parameter.
- Methods, local functions, constructors, and primary constructors of classes, structs, and records are in scope.
- Default severity is warning. Set ParameterListLayoutAnalyzerSeverity to warning, error, message, or off.
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.