/Roslynator

A collection of 110+ analyzers and 160+ refactorings for C#, powered by Roslyn.

Primary LanguageC#OtherNOASSERTION

Roslynator

Options

  • Refactorings can be enabled/disabled in Visual Studio options

Refactorings Options

Products

Extensions for Visual Studio 2017

Extensions for Visual Studio 2015

  • Roslynator extension for Visual Studio 2015 that contains both analyzers and refactorings.
  • Roslynator Refactorings extension for Visual Studio 2015 that contains only refactorings.

NuGet Packages

  • C# Analyzers NuGet package that contains only analyzers.
    • This package is dependent on Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0 (Visual Studio 2015 or higher).

List of Analyzers

  • RCS1001 - Add braces
  • RCS1002 - Remove braces
  • RCS1003 - Add braces to if-else
  • RCS1004 - Remove braces from if-else
  • RCS1005 - Simplify nested using statement
  • RCS1006 - Merge else clause with nested if statement
  • RCS1007 - Avoid embedded statement
  • RCS1008 - Use explicit type instead of 'var' (when the type is not obvious)
  • RCS1009 - Use explicit type instead of 'var' (foreach variable)
  • RCS1010 - Use 'var' instead of explicit type (when the type is obvious)
  • RCS1012 - Use explicit type instead of 'var' (even if the type is obvious)
  • RCS1013 - Use predefined type
  • RCS1014 - Avoid implicitly-typed array
  • RCS1015 - Use nameof operator
  • RCS1016 - Use expression-bodied member
  • RCS1017 - Avoid multiline expression body
  • RCS1018 - Add default access modifier
  • RCS1019 - Reorder modifiers
  • RCS1020 - Simplify Nullable to T?
  • RCS1021 - Simplify lambda expression
  • RCS1022 - Simplify lambda expression parameter list
  • RCS1023 - Format empty block
  • RCS1024 - Format accessor list
  • RCS1025 - Format each enum member on a separate line
  • RCS1026 - Format each statement on a separate line
  • RCS1027 - Format embedded statement on a separate line
  • RCS1028 - Format switch section's statement on a separate line
  • RCS1029 - Format binary operator on next line
  • RCS1030 - Add empty line after embedded statement
  • RCS1031 - Remove redundant braces
  • RCS1032 - Remove redundant parentheses
  • RCS1033 - Remove redundant boolean literal
  • RCS1034 - Remove redundant sealed modifier
  • RCS1035 - Remove redundant comma in initializer
  • RCS1036 - Remove redundant empty line
  • RCS1037 - Remove trailing white-space
  • RCS1038 - Remove empty statement
  • RCS1039 - Remove empty attribute argument list
  • RCS1040 - Remove empty else clause
  • RCS1041 - Remove empty initializer
  • RCS1042 - Remove enum default underlying type
  • RCS1043 - Remove partial modifier from type with a single part
  • RCS1044 - Remove original exception from throw statement
  • RCS1045 - Rename private field according to camel case with underscore
  • RCS1046 - Asynchronous method name should end with 'Async'
  • RCS1047 - Non-asynchronous method name should not end with 'Async'
  • RCS1048 - Replace anonymous method with lambda expression
  • RCS1049 - Simplify boolean comparison
  • RCS1050 - Add constructor argument list
  • RCS1051 - Parenthesize condition in conditional expression
  • RCS1052 - Declare each attribute separately
  • RCS1054 - Merge local declaration with return statement
  • RCS1055 - Avoid semicolon at the end of declaration
  • RCS1056 - Avoid usage of using alias directive
  • RCS1057 - Add empty line between declarations
  • RCS1058 - Use compound assignment
  • RCS1059 - Avoid locking on publicly accessible instance
  • RCS1060 - Declare each type in separate file
  • RCS1061 - Merge if statement with nested if statement
  • RCS1062 - Avoid interpolated string with no interpolation
  • RCS1063 - Avoid usage of do statement to create an infinite loop
  • RCS1064 - Avoid usage of for statement to create an infinite loop
  • RCS1065 - Avoid usage of while statement to create an inifinite loop
  • RCS1066 - Remove empty finally clause
  • RCS1067 - Remove empty argument list
  • RCS1068 - Simplify logical not expression
  • RCS1069 - Remove unnecessary case label
  • RCS1070 - Remove redundant default switch section
  • RCS1071 - Remove redundant base constructor call
  • RCS1072 - Remove empty namespace declaration
  • RCS1073 - Replace if statement with return statement
  • RCS1074 - Remove redundant constructor
  • RCS1075 - Avoid empty catch clause that catches System.Exception
  • RCS1076 - Format declaration braces
  • RCS1077 - Simplify LINQ method chain
  • RCS1078 - Replace string.Empty with ""
  • RCS1079 - Throwing of new NotImplementedException
  • RCS1080 - Replace 'Any' method with 'Count' or 'Length' property
  • RCS1081 - Split variable declaration
  • RCS1082 - Replace 'Count' method with 'Count' or 'Length' property
  • RCS1083 - Replace 'Count' method with 'Any' method
  • RCS1084 - Replace conditional expression with coalesce expression
  • RCS1085 - Replace property with auto-implemented property
  • RCS1086 - Use linefeed as newline
  • RCS1087 - Use carriage return + linefeed as newline
  • RCS1088 - Avoid usage of tab
  • RCS1089 - Use postfix unary operator instead of assignment
  • RCS1090 - Call 'ConfigureAwait(false)'
  • RCS1091 - Remove empty region
  • RCS1092 - Add empty line after last statement in do statement
  • RCS1093 - Remove file with no code
  • RCS1094 - Declare using directive on top level
  • RCS1095 - Use C# 6.0 dictionary initializer
  • RCS1096 - Use bitwise operation instead of 'HasFlag' method
  • RCS1097 - Remove redundant 'ToString' call
  • RCS1098 - Avoid 'null' on the left side of a binary expression
  • RCS1099 - Default label should be last label in switch section
  • RCS1100 - Format documentation summary on a single line
  • RCS1101 - Format documentation summary on multiple lines
  • RCS1102 - Mark class as static
  • RCS1103 - Replace if statement with assignment
  • RCS1104 - Simplify conditional expression
  • RCS1105 - Merge interpolation into interpolated string
  • RCS1106 - Remove empty destructor
  • RCS1107 - Remove redundant 'ToCharArray' call
  • RCS1108 - Add static modifier to all partial class declarations
  • RCS1109 - Use 'Cast' method instead of 'Select' method
  • RCS1110 - Declare type inside namespace
  • RCS1111 - Add braces to switch section with multiple statements
  • RCS1112 - Combine 'Enumerable.Where' method chain
  • RCS1113 - Use 'string.IsNullOrEmpty' method
  • RCS1114 - Remove redundant delegate creation

List of Refactorings