Awesome
ReflectionAnalyzers
Analyzers checking System.Reflection
Id | Title |
---|---|
REFL001 | Cast return value to the correct type |
REFL002 | Discard the return value |
REFL003 | The member does not exist |
REFL004 | More than one member is matching the criteria |
REFL005 | There is no member matching the filter |
REFL006 | The binding flags can be more precise |
REFL007 | The binding flags are not in the expected order |
REFL008 | Specify binding flags for better performance and less fragile code |
REFL009 | The referenced member is not known to exist |
REFL010 | Prefer the generic extension method GetCustomAttribute<T> |
REFL011 | Duplicate BindingFlag |
REFL012 | Prefer Attribute.IsDefined() |
REFL013 | The member is of the wrong type |
REFL014 | Prefer GetMember().AccessorMethod |
REFL015 | Use the containing type |
REFL016 | Use nameof |
REFL017 | Don't use name of wrong member |
REFL018 | The member is explicitly implemented |
REFL019 | No member matches the types |
REFL020 | More than one interface is matching the name |
REFL022 | Use fully qualified name |
REFL023 | The type does not implement the interface |
REFL024 | Prefer null over empty array |
REFL025 | Use correct arguments |
REFL026 | No parameterless constructor defined for this object |
REFL027 | Prefer Type.EmptyTypes |
REFL028 | Cast return value to correct type |
REFL029 | Specify types in case an overload is added in the future |
REFL030 | Use correct obj parameter |
REFL031 | Use generic arguments that satisfies the type parameters |
REFL032 | The dependency does not exist |
REFL033 | Use the same type as the parameter |
REFL034 | Don't call MakeGeneric when not a generic definition |
REFL035 | Don't call Invoke on a generic definition |
REFL036 | Pass 'throwOnError: true' or check if null |
REFL037 | The type does not exist |
REFL038 | Prefer RuntimeHelpers.RunClassConstructor |
REFL039 | Prefer typeof(...) over instance.GetType when the type is sealed |
REFL040 | Prefer type.IsInstanceOfType(...) |
REFL041 | Delegate type is not matching |
REFL042 | First argument must be reference type |
REFL043 | First argument must match type |
REFL044 | Expected attribute type |
REFL045 | These flags are insufficient to match any members |
REFL046 | The specified default member does not exist |
Using ReflectionAnalyzers
The preferable way to use the analyzers is to add the nuget package ReflectionAnalyzers to the project(s).
The severity of individual rules may be configured using rule set files in Visual Studio 2015.
Installation
ReflectionAnalyzers can be installed using:
- Paket
- NuGet command line
- NuGet Package Manager in Visual Studio.
Install using the command line:
paket add ReflectionAnalyzers --project <project>
or if you prefer NuGet
Install-Package ReflectionAnalyzers