Supported Code Analyzers
120 code analyzers for C#
- Suggests using the class declaring a static function when calling it (AccessToStaticMemberViaDerivedTypeAnalyzer)
- When initializing explicitly typed local variable or array type, array creation expression can be replaced with array initializer. (ArrayCreationCanBeReplacedWithArrayInitializerAnalyzer)
- Asynchronous methods should return a Task instead of void (AvoidAsyncVoidAnalyzer)
- Base parameter has 'params' modifier, but missing in overrider (BaseMemberHasParamsAnalyzer)
- Call to base member with implicit default parameters (BaseMethodCallWithDefaultParameterAnalyzer)
- Parameter name differs in base declaration (BaseMethodParameterNameMismatchAnalyzer)
- Bitwise operation on enum which has no [Flags] attribute (BitwiseOperatorOnEnumWithoutFlagsAnalyzer)
- Finds potentially erroneous calls to Object.Equals (CallToObjectEqualsViaBaseAnalyzer)
- Possible compare of value type with 'null' (CompareNonConstrainedGenericWithNullAnalyzer)
- Comparison of floating point numbers with equality operator (CompareOfFloatsByEqualityOperatorAnalyzer)
- '?:' expression has identical true and false branches (ConditionalTernaryEqualBranchAnalyzer)
- Expression is always 'true' or always 'false' (ConditionIsAlwaysTrueOrFalseAnalyzer)
- Condition is always 'true' or always 'false' (ConstantConditionAnalyzer)
- Finds redundant null coalescing expressions such as expr ?? expr (ConstantNullCoalescingConditionAnalyzer)
- Convert anonymous method to method group (ConvertClosureToMethodGroupAnalyzer)
- '?:' expression can be converted to '??' expression (ConvertConditionalTernaryToNullCoalescingAnalyzer)
- Convert 'if-do-while' to 'while' statement (ConvertIfDoToWhileAnalyzer)
- 'if' statement can be re-written as 'switch' statement (ConvertIfStatementToSwitchStatementAnalyzer)
- Convert 'if' to '&&' expression (ConvertIfToAndExpressionAnalyzer)
- Convert 'if' to '||' expression (ConvertIfToOrExpressionAnalyzer)
- Convert 'Nullable<T>' to the short form 'T?' (ConvertNullableToShortFormAnalyzer)
- If all fields, properties and methods members are static, the class can be made static. (ConvertToStaticTypeAnalyzer)
- Delegate subtraction has unpredictable result (DelegateSubtractionAnalyzer)
- Warns about calls to virtual member functions occuring in the constructor (DoNotCallOverridableMethodsInConstructorAnalyzer)
- Double negation is redundant (DoubleNegationOperatorAnalyzer)
- An empty public constructor without parameters is redundant. (EmptyConstructorAnalyzer)
- Empty destructor is redundant (EmptyDestructorAnalyzer)
- Empty control statement body (EmptyEmbeddedStatementAnalyzer)
- A catch clause that catches System.Exception and has an empty body (EmptyGeneralCatchClauseAnalyzer)
- Empty namespace declaration is redundant (EmptyNamespaceAnalyzer)
- Empty statement is redundant (EmptyStatementAnalyzer)
- The default underlying type of enums is int, so defining it explicitly is redundant. (EnumUnderlyingTypeIsIntAnalyzer)
- Comparing equal expression for equality is usually useless (EqualExpressionComparisonAnalyzer)
- Event unsubscription via anonymous delegate is useless (EventUnsubscriptionViaAnonymousDelegateAnalyzer)
- Convert field to readonly (FieldCanBeMadeReadOnlyAnalyzer)
- 'for' loop control variable is never modified (ForControlVariableIsNeverModifiedAnalyzer)
- Finds issues with format strings (FormatStringProblemAnalyzer)
- 'true' is redundant as for statement condition (ForStatementConditionIsTrueAnalyzer)
- Function does not reach its end or a 'return' statement by any of possible execution paths (FunctionNeverReturnsAnalyzer)
- If an extension method is called as static method convert it to method syntax (InvokeAsExtensionMethodAnalyzer)
- Local variable has the same name as a member and hides it (LocalVariableHidesMemberAnalyzer)
- Local variable is never used (LocalVariableNotUsedAnalyzer)
- Lowercase 'l' is often confused with '1' (LongLiteralEndingLowerLAnalyzer)
- Member hides static member from outer class (MemberHidesStaticFromOuterClassAnalyzer)
- Method with optional parameter is hidden by overload (MethodOverloadWithOptionalParameterAnalyzer)
- Suggest the usage of the nameof operator (NameOfSuggestionAnalyzer)
- Non public methods are not found by NUnit (NonPublicMethodWithTestAttributeAnalyzer)
- Non-readonly field referenced in 'GetHashCode()' (NonReadonlyReferencedInGetHashCodeAnalyzer)
- Shows NotImplementedException throws in the quick task bar (NotImplementedExceptionAnalyzer)
- Cannot resolve symbol in text argument (NotResolvedInTextAnalyzer)
- Possible unassigned object created by 'new' (ObjectCreationAsStatementAnalyzer)
- Operator Is can be used instead of comparing object GetType() and instances of System.Type object (OperatorIsCanBeUsedAnalyzer)
- C# doesn't support optional 'ref' or 'out' parameters (OptionalParameterRefOutAnalyzer)
- Parameter has the same name as a member and hides it (ParameterHidesMemberAnalyzer)
- Parameter is assigned but its value is never used (ParameterOnlyAssignedAnalyzer)
- Parameter name differs in partial method definition (PartialMethodParameterNameMismatchAnalyzer)
- Class is declared partial but has only one part (PartialTypeWithSinglePartAnalyzer)
- Possible mistaken call to 'object.GetType()' (PossibleMistakenCallToGetTypeAnalyzer)
- Constructor in abstract class should not be public (PublicConstructorInAbstractClassAnalyzer)
- Redundant explicit property name (RedundantAnonymousTypePropertyNameAnalyzer)
- Redundant explicit argument name specification (RedundantArgumentNameAnalyzer)
- Parentheses are redundant if attribute has no arguments (RedundantAttributeParenthesesAnalyzer)
- This is generated by the compiler and can be safely removed (RedundantBaseConstructorCallAnalyzer)
- 'base.' is redundant and can safely be removed (RedundantBaseQualifierAnalyzer)
- Redundant case label (RedundantCaseLabelAnalyzer)
- Check for inequality before assignment is redundant if (x != value) x = value; (RedundantCheckBeforeAssignmentAnalyzer)
- Redundant comma in array initializer (RedundantCommaInArrayInitializerAnalyzer)
- Initializing field with default value is redundant (RedundantDefaultFieldInitializerAnalyzer)
- Explicit delegate creation expression is redundant (RedundantDelegateCreationAnalyzer)
- Redundant empty 'default' switch branch (RedundantEmptyDefaultSwitchBranchAnalyzer)
- Redundant empty finally block (RedundantEmptyFinallyBlockAnalyzer)
- Redundant explicit size in array creation (RedundantExplicitArraySizeAnalyzer)
- Value types are implicitly convertible to nullables (RedundantExplicitNullableCreationAnalyzer)
- Redundant 'else' keyword (RedundantIfElseBlockAnalyzer)
- Removes 'internal' modifiers that are not required (RedundantInternalAnalyzer)
- When object creation uses object or collection initializer, empty argument list is redundant (RedundantObjectCreationArgumentListAnalyzer)
- Removes 'private' modifiers that are not required (RedundantPrivateAnalyzer)
- Redundant 'string.ToCharArray()' call (RedundantStringToCharArrayCallAnalyzer)
- Redundant conditional expression (RedundantTernaryExpressionAnalyzer)
- RedundantToStringCallAnalyzer
- Unsafe modifier in redundant in unsafe context or when no unsafe constructs are used (RedundantUnsafeContextAnalyzer)
- Remove redundant statement (RemoveRedundantOrStatementAnalyzer)
- Replace with call to FirstOrDefault<T>() (ReplaceWithFirstOrDefaultAnalyzer)
- Replace with call to LastOrDefault<T>() (ReplaceWithLastOrDefaultAnalyzer)
- Replace with call to OfType<T> (ReplaceWithOfTypeAnalyzer)
- Replace with call to OfType<T>().Any() (ReplaceWithOfTypeAnyAnalyzer)
- Replace with call to OfType<T>().Count() (ReplaceWithOfTypeCountAnalyzer)
- Replace with call to OfType<T>().First() (ReplaceWithOfTypeFirstAnalyzer)
- Replace with call to OfType<T>().FirstOrDefault() (ReplaceWithOfTypeFirstOrDefaultAnalyzer)
- Replace with call to OfType<T>().Last() (ReplaceWithOfTypeLastAnalyzer)
- Replace with call to OfType<T>().LastOrDefault() (ReplaceWithOfTypeLastOrDefaultAnalyzer)
- Replace with call to OfType<T>().LongCount() (ReplaceWithOfTypeLongCountAnalyzer)
- Replace with call to OfType<T>().Single() (ReplaceWithOfTypeSingleAnalyzer)
- Replace with call to OfType<T>().SingleOrDefault() (ReplaceWithOfTypeSingleOrDefaultAnalyzer)
- Replace with call to OfType<T>().Where() (ReplaceWithOfTypeWhereAnalyzer)
- Replace with simple assignment (ReplaceWithSimpleAssignmentAnalyzer)
- Redundant Where() call with predicate followed by Any() (ReplaceWithSingleCallToAnyAnalyzer)
- Redundant Where() call with predicate followed by Count() (ReplaceWithSingleCallToCountAnalyzer)
- Redundant Where() call with predicate followed by First() (ReplaceWithSingleCallToFirstAnalyzer)
- Redundant Where() call with predicate followed by FirstOrDefault() (ReplaceWithSingleCallToFirstOrDefaultAnalyzer)
- Redundant Where() call with predicate followed by Last() (ReplaceWithSingleCallToLastAnalyzer)
- Redundant Where() call with predicate followed by LastOrDefault() (ReplaceWithSingleCallToLastOrDefaultAnalyzer)
- Redundant Where() call with predicate followed by LongCount() (ReplaceWithSingleCallToLongCountAnalyzer)
- Redundant Where() call with predicate followed by Single() (ReplaceWithSingleCallToSingleAnalyzer)
- Redundant Where() call with predicate followed by SingleOrDefault() (ReplaceWithSingleCallToSingleOrDefaultAnalyzer)
- Uses shorter string.IsNullOrEmpty call instead of a longer condition (ReplaceWithStringIsNullOrEmptyAnalyzer)
- 'sealed' modifier is redundant in sealed classes (SealedMemberInSealedClassAnalyzer)
- Conditional expression can be simplified (SimplifyConditionalTernaryExpressionAnalyzer)
- Warns about static fields in generic types (StaticFieldOrAutoPropertyInGenericTypeAnalyzer)
- Warns when a culture-aware 'string.CompareTo' call is used by default (StringCompareToIsCultureSpecificAnalyzer)
- Warns when a culture-aware 'EndsWith' call is used by default. (StringEndsWithIsCultureSpecificAnalyzer)
- Warns when a culture-aware 'IndexOf' call is used by default. (StringIndexOfIsCultureSpecificAnalyzer)
- Warns when a culture-aware 'LastIndexOf' call is used by default. (StringLastIndexOfIsCultureSpecificAnalyzer)
- Warns when a culture-aware 'StartsWith' call is used by default. (StringStartsWithIsCultureSpecificAnalyzer)
- Use 'var' keyword when possible (SuggestUseVarKeywordEvidentAnalyzer)
- [ThreadStatic] doesn't work with instance fields (ThreadStaticAtInstanceFieldAnalyzer)
- Parameter is never used (UnusedParameterAnalyzer)
- Type parameter is never used (UnusedTypeParameterAnalyzer)
- Warns about property or indexer setters and event adders or removers that do not use the value parameter (ValueParameterNotUsedAnalyzer)
- Validate Xml docs (XmlDocAnalyzer)