Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Apr 23, 2024
1 parent d15b085 commit f24285b
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions src/Workspaces.Core/Diagnostics/CodeAnalyzer.cs
Expand Up @@ -205,32 +205,26 @@ private IEnumerable<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> diagno
{
if (diagnostic.IsEffective(Options, project.CompilationOptions, cancellationToken))
{
bool? isCompiler = null;

if (Options.ReportNotConfigurable
|| (isCompiler ??= diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Compiler))
|| !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.NotConfigurable))
if (diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Compiler))
{
if (isCompiler ??= diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Compiler))
{
Debug.Assert(diagnostic.Id.StartsWith("CS", "VB", StringComparison.Ordinal), diagnostic.Id);
Debug.Assert(diagnostic.Id.StartsWith("CS", "VB", StringComparison.Ordinal), diagnostic.Id);

SyntaxTree? tree = diagnostic.Location.SourceTree;
SyntaxTree? tree = diagnostic.Location.SourceTree;

if (tree is null
|| Options.FileSystemFilter?.IsMatch(tree.FilePath) != false)
{
if (tree is null
|| Options.FileSystemFilter?.IsMatch(tree.FilePath) != false)
|| !GeneratedCodeUtility.IsGeneratedCode(tree, f => MefWorkspaceServices.Default.GetService<ISyntaxFactsService>(tree.Options.Language)!.IsComment(f), cancellationToken))
{
if (tree is null
|| !GeneratedCodeUtility.IsGeneratedCode(tree, f => MefWorkspaceServices.Default.GetService<ISyntaxFactsService>(tree.Options.Language)!.IsComment(f), cancellationToken))
{
yield return diagnostic;
}
yield return diagnostic;
}
}
else
{
yield return diagnostic;
}
}
else if (Options.ReportNotConfigurable
|| !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.NotConfigurable))
{
yield return diagnostic;
}
}
}
Expand Down

0 comments on commit f24285b

Please sign in to comment.