Skip to content

Commit 3ed27c5

Browse files
committed
Extract HasImplementation method
1 parent 089fc70 commit 3ed27c5

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

StyleCop.Analyzers.Status.Generator/SolutionReader.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ public async Task<ImmutableList<StyleCopDiagnostic>> GetDiagnosticsAsync()
125125
string shortName = match.Groups["name"].Value;
126126
CodeFixStatus codeFixStatus;
127127
string noCodeFixReason = null;
128-
bool hasImplementation = true;
129128

130129
// Check if this syntax tree represents a diagnostic
131130
SyntaxNode syntaxRoot = await syntaxTree.GetRootAsync();
@@ -139,16 +138,7 @@ public async Task<ImmutableList<StyleCopDiagnostic>> GetDiagnosticsAsync()
139138
continue;
140139
}
141140

142-
foreach (var trivia in syntaxRoot.DescendantTrivia())
143-
{
144-
if (trivia.IsKind(SyntaxKind.SingleLineCommentTrivia))
145-
{
146-
if (trivia.ToFullString().Contains("TODO: Implement analysis"))
147-
{
148-
hasImplementation = false;
149-
}
150-
}
151-
}
141+
bool hasImplementation = HasImplementation(syntaxRoot);
152142

153143
codeFixStatus = this.HasCodeFix(id, classSymbol, out noCodeFixReason);
154144

@@ -174,6 +164,23 @@ public async Task<ImmutableList<StyleCopDiagnostic>> GetDiagnosticsAsync()
174164
return diagnostics.ToImmutable();
175165
}
176166

167+
private static bool HasImplementation(SyntaxNode syntaxRoot)
168+
{
169+
bool hasImplementation = true;
170+
foreach (var trivia in syntaxRoot.DescendantTrivia())
171+
{
172+
if (trivia.IsKind(SyntaxKind.SingleLineCommentTrivia))
173+
{
174+
if (trivia.ToFullString().Contains("TODO: Implement analysis"))
175+
{
176+
hasImplementation = false;
177+
}
178+
}
179+
}
180+
181+
return hasImplementation;
182+
}
183+
177184
private string GetStatus(INamedTypeSymbol classSymbol, SyntaxNode root, SemanticModel model)
178185
{
179186
// Some analyzers use multiple descriptors. We analyze the first one and hope that

0 commit comments

Comments
 (0)