This is a collection of warnings and refactorings with no real plan/scope. Made a package of it for the event someone finds something useful in it.
Id | Title |
---|---|
GU0001 | Name the argument |
GU0002 | The position of a named argument should match |
GU0003 | Name the parameter to match the assigned member |
GU0004 | Assign all readonly members |
GU0005 | Use correct argument positions |
GU0006 | Use nameof |
GU0007 | Prefer injecting |
GU0008 | Avoid relay properties |
GU0009 | Name the boolean argument |
GU0010 | Assigning same value |
GU0011 | Don't ignore the returned value |
GU0012 | Check if parameter is null |
GU0013 | Throw for correct parameter |
GU0014 | Prefer using parameter |
GU0015 | Don't assign same more than once |
GU0016 | Prefer lambda |
GU0017 | Don't use discarded |
GU0018a | Name mock |
GU0018b | Name mock |
GU0019 | LinqOrDefault when IEnumerable |
GU0020 | Sort properties |
GU0021 | Calculated property allocates reference type |
GU0022 | Use get-only |
GU0023 | Static members that initialize with other static members depend on document order |
GU0024 | Seal type with default member |
GU0025 | Seal type with overridden equality |
GU0026 | Range operator allocates |
GU0050 | Ignore events when serializing |
GU0051 | Cache the XmlSerializer |
GU0052 | Mark exception with [Serializable] |
GU0060 | Enum member value conflict |
GU0061 | Enum member value out of range |
GU0070 | Default-constructed value type with no useful default |
GU0071 | Implicit casting done by the foreach |
GU0072 | All types should be internal |
GU0073 | Member of non-public type should be internal |
GU0074 | Prefer pattern |
GU0075 | Prefer return nullable |
GU0076 | Merge pattern |
GU0077 | Prefer is null |
GU0080 | Parameter count does not match attribute |
GU0081 | TestCase does not match parameters |
GU0082 | TestCase is identical to other |
GU0083 | TestCase Arguments Mismatch Method Parameters |
GU0084 | Assert exception message |
GU0090 | Don't throw NotImplementedException |
GU0100 | Wrong cref type |
The preferable way to use the analyzers is to add the nuget package Gu.Analyzers to the project(s).
The severity of individual rules may be configured using rule set files in Visual Studio 2015.
Gu.Analyzers can be installed using Paket or the NuGet command line or the NuGet Package Manager in Visual Studio 2015.
Install using the command line:
Install-Package Gu.Analyzers
The ruleset editor does not handle changes IDs well, if things get out of sync you can try:
- Close visual studio.
- Edit the ProjectName.rulset file and remove the Gu.Analyzers element.
- Start visual studio and add back the desired configuration.
Above is not ideal, sorry about this. Not sure this is our bug.
Early alpha, names and IDs may change.