Skip to content

Commit

Permalink
Remove type check - not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
costin-zaharia-sonarsource committed Nov 22, 2021
1 parent c3bb22f commit c729f64
Showing 1 changed file with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ protected override void Initialize(SonarAnalysisContext context) =>
if (namedType.ContainingType != null
// We skip top level statements since they cannot have fields. Other declared types are analyzed separately.
|| IsTopLevelProgram(namedType)
|| !IsType(namedType)
|| namedType.DerivesFromAny(IgnoredTypes))
{
return;
Expand Down Expand Up @@ -139,13 +138,6 @@ private static bool IsTopLevelProgram(ISymbol symbol) =>
symbol.Name == "Program"
&& symbol.ContainingNamespace.IsGlobalNamespace;

private static bool IsType(ITypeSymbol namedType) =>
namedType.TypeKind == TypeKind.Struct
|| namedType.TypeKind == TypeKind.Class
|| namedType.TypeKind == TypeKind.Delegate
|| namedType.TypeKind == TypeKind.Enum
|| namedType.TypeKind == TypeKind.Interface;

private static IEnumerable<Diagnostic> GetDiagnosticsForUnusedPrivateMembers(CSharpSymbolUsageCollector usageCollector,
ISet<ISymbol> removableSymbols,
string accessibility,
Expand Down

0 comments on commit c729f64

Please sign in to comment.