Skip to content

Commit 5232445

Browse files
committed
chore: generator cleanups
1 parent 6396e08 commit 5232445

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/FluentAssertions.Analyzers.FluentAssertionAnalyzerDocsGenerator/DocsGenerator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Reflection;
66
using System.Text;
77
using System.Threading.Tasks;
8+
using FluentAssertions.Analyzers.TestUtils;
89
using Microsoft.CodeAnalysis;
910
using Microsoft.CodeAnalysis.CSharp;
1011
using Microsoft.CodeAnalysis.CSharp.Syntax;
@@ -17,10 +18,10 @@ public class DocsGenerator
1718
{
1819
public async Task Execute()
1920
{
20-
DiagnosticAnalyzer analyzer = new FluentAssertionsAnalyzer();
21+
var analyzers = ImmutableArray.Create(CodeAnalyzersUtils.GetAllAnalyzers());
2122

2223
var compilation = await FluentAssertionAnalyzerDocsUtils.GetFluentAssertionAnalyzerDocsCompilation();
23-
var compilationWithAnalyzers = compilation.WithAnalyzers(ImmutableArray.Create(analyzer));
24+
var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers);
2425

2526
var testAssembly = typeof(FluentAssertionAnalyzerDocs.FluentAssertionsAnalyzerTests).Assembly;
2627

@@ -150,7 +151,7 @@ public async Task Execute()
150151
}
151152

152153
var diagnostics = await compilationWithAnalyzers.GetAllDiagnosticsAsync();
153-
foreach (var diagnostic in diagnostics.Where(diagnostic => analyzer.SupportedDiagnostics.Any(d => d.Id == diagnostic.Id)))
154+
foreach (var diagnostic in diagnostics.Where(diagnostic => analyzers.Any(analyzer => analyzer.SupportedDiagnostics.Any(d => d.Id == diagnostic.Id))))
154155
{
155156
Console.WriteLine($"source: {root.FindNode(diagnostic.Location.SourceSpan)}");
156157
Console.WriteLine($" diagnostic: {diagnostic}");

src/FluentAssertions.Analyzers.FluentAssertionAnalyzerDocsGenerator/FluentAssertions.Analyzers.FluentAssertionAnalyzerDocsGenerator.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.3.1" PrivateAssets="all" />
1414
<PackageReference Include="Microsoft.Build.Locator" Version="1.7.1" />
1515
<ProjectReference Include="..\FluentAssertions.Analyzers\FluentAssertions.Analyzers.csproj" />
16+
<ProjectReference Include="..\FluentAssertions.Analyzers.TestUtils\FluentAssertions.Analyzers.TestUtils.csproj" />
1617
<ProjectReference Include="..\FluentAssertions.Analyzers.FluentAssertionAnalyzerDocs\FluentAssertions.Analyzers.FluentAssertionAnalyzerDocs.csproj" />
1718
</ItemGroup>
1819

0 commit comments

Comments
 (0)