Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,4 @@ FodyWeavers.xsd
*.msix
*.msm
*.msp
.claude/settings.local.json
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ A Roslyn analyzer to enforce some good practices in C# in terms of design, usage
dotnet add package Atc.Analyzer
```

## Compatibility

| Requirement | Minimum Version |
| --- | --- |
| .NET SDK | 6.0+ |
| Visual Studio | 2022 (17.0+) |
| Roslyn | 4.14.0+ |

The analyzer is built against Roslyn 4.14.0 for broad compatibility with .NET 6, 7, 8, 9, and 10 projects.

## Usage

Once installed, the analyzer will automatically run during compilation and highlight code issues in your IDE. Code fixes are available for many rules and can be applied directly from your IDE.
Expand All @@ -18,7 +28,7 @@ Once installed, the analyzer will automatically run during compilation and highl
| --- | --- | --- | --- | --- | --- |
| [ATC201](docs/rules/ATC201.md) | Style | Single parameter should be kept inline when declaration is short | ⚠️ Warning | ✔️ Yes | ✅ Yes |
| [ATC202](docs/rules/ATC202.md) | Style | Multi parameters should be separated on individual lines | ⚠️ Warning | ✔️ Yes | ✅ Yes |
| [ATC203](docs/rules/ATC203.md) | Style | Method chains with 2 or more calls should be placed on separate lines | ⚠️ Warning | ✔️ Yes | ✅ Yes |
| [ATC203](docs/rules/ATC203.md) | Style | Method chains with 2 or more calls should be placed on separate lines | ℹ️ Suggestion | ✔️ Yes | ✅ Yes |
| [ATC210](docs/rules/ATC210.md) | Style | Use expression body syntax when appropriate | ⚠️ Warning | ✔️ Yes | ✅ Yes |
| [ATC220](docs/rules/ATC220.md) | Style | Use global usings for all namespaces (strict policy) | ⚠️ Warning | ✔️ Yes | ✅ Yes |
| [ATC221](docs/rules/ATC221.md) | Style | Use global usings for common namespaces (lenient policy) | ⚠️ Warning | ✔️ Yes | ✅ Yes |
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/ATC203.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Style

## ⚠️ Severity

Warning
Suggestion (Info)

## 📖 Description

Expand Down
6 changes: 6 additions & 0 deletions src/Atc.Analyzer/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@

Rule ID | Category | Severity | Notes
--------|----------|----------|-------

### Changed Rules

Rule ID | New Category | New Severity | Old Category | Old Severity | Notes
--------|--------------|--------------|--------------|--------------|-------
ATC203 | Style | Info | Style | Warning | Changed severity from Warning to Info (Suggestion)
4 changes: 2 additions & 2 deletions src/Atc.Analyzer/Atc.Analyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed class MethodChainSeparationAnalyzer : DiagnosticAnalyzer
title: "Method chains with 2 or more calls should be placed on separate lines",
messageFormat: "Method chains with 2 or more calls should be broken down to separate lines",
RuleCategoryConstants.Style,
DiagnosticSeverity.Warning,
DiagnosticSeverity.Info,
isEnabledByDefault: true,
description: "Ensures consistent method chain formatting. When chaining 2 or more method calls, each method should be on a separate line for better readability.",
helpLinkUri: RuleIdentifierHelper.GetHelpUri(RuleIdentifierConstants.Style.MethodChainSeparation));
Expand Down
2 changes: 1 addition & 1 deletion test/Atc.Analyzer.Tests/Atc.Analyzer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void TestMethod(string str)
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(5, 22, 5, 42),
};

Expand Down Expand Up @@ -73,7 +73,7 @@ public void TestMethod(string str)
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(5, 22, 5, 62),
};

Expand Down Expand Up @@ -116,7 +116,7 @@ public void TestMethod(List<int> numbers)
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(8, 22, 8, 75),
};

Expand Down Expand Up @@ -157,7 +157,7 @@ public void TestMethod()
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(7, 22, 7, 85),
};

Expand Down Expand Up @@ -193,7 +193,7 @@ public string TestMethod(string str)
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(5, 16, 5, 36),
};

Expand Down Expand Up @@ -237,7 +237,7 @@ public async Task TestMethod()
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(9, 22, 9, 86),
};

Expand Down Expand Up @@ -274,7 +274,7 @@ public void TestMethod(string str)
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(5, 22, 5, 72),
};

Expand Down Expand Up @@ -314,7 +314,7 @@ public void TestMethod()
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(7, 22, 7, 72),
};

Expand Down Expand Up @@ -352,7 +352,7 @@ public void TestMethod(string str)
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(6, 18, 6, 38),
};

Expand Down Expand Up @@ -392,7 +392,7 @@ public void TestMethod(string str)
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(7, 27, 7, 47),
};

Expand Down Expand Up @@ -440,7 +440,7 @@ public void TestMethod()
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(9, 30, 9, 53),
};

Expand Down Expand Up @@ -482,7 +482,7 @@ public void TestMethod()
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(7, 18, 7, 92),
};

Expand Down Expand Up @@ -522,7 +522,7 @@ public void TestMethod()
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(7, 22, 7, 67),
};

Expand Down Expand Up @@ -566,7 +566,7 @@ public void TestMethod()
{
new DiagnosticResult(
"ATC203",
DiagnosticSeverity.Warning)
DiagnosticSeverity.Info)
.WithSpan(7, 18, 9, 24),
};

Expand Down