Skip to content

Instantly share code, notes, and snippets.

@kurnakovv
Last active November 29, 2025 05:53
Show Gist options
  • Select an option

  • Save kurnakovv/ff955cd224602b738f697f3246fcda92 to your computer and use it in GitHub Desktop.

Select an option

Save kurnakovv/ff955cd224602b738f697f3246fcda92 to your computer and use it in GitHub Desktop.
Favorite Roslynator rules in .editorconfig
[*.cs]
##
## Roslynator
##
# All rules here https://josefpihrt.github.io/docs/roslynator/configuration
# Disable all rules
dotnet_analyzer_diagnostic.category-roslynator.severity = none
# Row length limits
roslynator_max_line_length = 200
dotnet_diagnostic.rcs0056.severity = error
# VS extension https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelines
guidelines = 200
guidelines_style = 1px dotted purple
dotnet_diagnostic.rcs0009.severity = error # RCS0009: Add blank line between declaration and documentation comment https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0009
dotnet_diagnostic.rcs0021.severity = error # RCS0021: Format block's braces on a single line or multiple lines https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0021
dotnet_diagnostic.rcs0027.severity = error # RCS0027: Place new line after/before binary operator https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0027
dotnet_diagnostic.rcs0031.severity = error # RCS0031: Put enum member on its own line https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0031
dotnet_diagnostic.rcs0033.severity = error # RCS0033: Put statement on its own line https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0033
dotnet_diagnostic.rcs0034.severity = error # RCS0034: Put type parameter constraint on its own line https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0034
dotnet_diagnostic.rcs0041.severity = error # RCS0041: Remove new line between 'if' keyword and 'else' keyword https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0041
dotnet_diagnostic.rcs0050.severity = error # RCS0050: Add blank line before top declaration https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0050
dotnet_diagnostic.rcs0053.severity = error # RCS0053: Fix formatting of a list https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0053
dotnet_diagnostic.rcs1006.severity = error # RCS1006: Merge 'else' with nested 'if' https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1006
dotnet_diagnostic.rcs1033.severity = error # RCS1033: Remove redundant boolean literal https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1033
dotnet_diagnostic.rcs1034.severity = error # RCS1034: Remove redundant 'sealed' modifier https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1034
dotnet_diagnostic.rcs1043.severity = error # RCS1043: Remove 'partial' modifier from type with a single part https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1043
dotnet_diagnostic.rcs1046.severity = error # RCS1046: Asynchronous method name should end with 'Async' https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1046
dotnet_diagnostic.rcs1047.severity = error # RCS1047: Non-asynchronous method name should not end with 'Async' https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1047
dotnet_diagnostic.rcs1055.severity = error # RCS1055: Unnecessary semicolon at the end of declaration https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1055
dotnet_diagnostic.rcs1061.severity = error # RCS1061: Merge 'if' with nested 'if' https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1061
dotnet_diagnostic.rcs1071.severity = error # RCS1071: Remove redundant base constructor call https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1071
dotnet_diagnostic.rcs1073.severity = error # RCS1073: Convert 'if' to 'return' statement https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1073
dotnet_diagnostic.rcs1074.severity = error # RCS1074: Remove redundant constructor https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1074
dotnet_diagnostic.rcs1081.severity = error # RCS1081: Split variable declaration https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1081
dotnet_diagnostic.rcs1097.severity = error # RCS1097: Remove redundant 'ToString' call https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1097
dotnet_diagnostic.rcs1098.severity = error # RCS1098: Constant values should be placed on right side of comparisons https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1098
dotnet_diagnostic.rcs1099.severity = error # RCS1099: Default label should be the last label in a switch section https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1099
dotnet_diagnostic.rcs1103.severity = error # RCS1103: Convert 'if' to assignment https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1103
dotnet_diagnostic.rcs1104.severity = error # RCS1104: Simplify conditional expression https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1104
dotnet_diagnostic.rcs1105.severity = error # RCS1105: Unnecessary interpolation https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1105
dotnet_diagnostic.rcs1108.severity = error # RCS1108: Add 'static' modifier to all partial class declarations https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1108
dotnet_diagnostic.rcs1113.severity = error # RCS1113: Use 'string.IsNullOrEmpty' method https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1113
dotnet_diagnostic.rcs1114.severity = error # RCS1114: Remove redundant delegate creation https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1114
dotnet_diagnostic.rcs1124.severity = warning # RCS1124: Inline local variable https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1124
dotnet_diagnostic.rcs1129.severity = error # RCS1129: Remove redundant field initialization https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1129
dotnet_diagnostic.rcs1133.severity = error # RCS1133: Remove redundant Dispose/Close call https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1133
dotnet_diagnostic.rcs1136.severity = error # RCS1136: Merge switch sections with equivalent content https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1136
dotnet_diagnostic.rcs1146.severity = error # RCS1146: Use conditional access https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1146
dotnet_diagnostic.rcs1154.severity = error # RCS1154: Sort enum members https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1154
dotnet_diagnostic.rcs1161.severity = error # RCS1161: Enum should declare explicit values https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1161
dotnet_diagnostic.rcs1166.severity = error # RCS1166: Value type object is never equal to null https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1166
dotnet_diagnostic.rcs1170.severity = error # RCS1170: Use read-only auto-implemented property https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1170
dotnet_diagnostic.rcs1172.severity = error # RCS1172: Use 'is' operator instead of 'as' operator https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1172
dotnet_diagnostic.rcs1182.severity = error # RCS1182: Remove redundant base interface https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1182
dotnet_diagnostic.rcs1188.severity = error # RCS1188: Remove redundant auto-property initialization https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1188
dotnet_diagnostic.rcs1190.severity = error # RCS1190: Join string expressions https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1190
dotnet_diagnostic.rcs1192.severity = error # RCS1192: Unnecessary usage of verbatim string literal https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1192
dotnet_diagnostic.rcs1196.severity = error # RCS1196: Call extension method as instance method https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1196
dotnet_diagnostic.rcs1197.severity = error # RCS1197: Optimize StringBuilder.Append/AppendLine call https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1197
dotnet_diagnostic.rcs1199.severity = error # RCS1199: Unnecessary null check https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1199
dotnet_diagnostic.rcs1200.severity = error # RCS1200: Call 'Enumerable.ThenBy' instead of 'Enumerable.OrderBy' https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1200
dotnet_diagnostic.rcs1211.severity = error # RCS1211: Remove unnecessary 'else' https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1211
dotnet_diagnostic.rcs1215.severity = error # RCS1215: Expression is always equal to true/false https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1215
dotnet_diagnostic.rcs1220.severity = error # RCS1220: Use pattern matching instead of combination of 'is' operator and cast operator https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1220
dotnet_diagnostic.rcs1229.severity = error # RCS1229: Use async/await when necessary https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1229
dotnet_diagnostic.rcs1232.severity = error # RCS1232: Order elements in documentation comment https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1232
dotnet_diagnostic.rcs1236.severity = error # RCS1236: Use exception filter https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1236
dotnet_diagnostic.rcs1239.severity = error # RCS1239: Use 'for' statement instead of 'while' statement https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1239
dotnet_diagnostic.rcs1243.severity = error # RCS1243: Duplicate word in a comment https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1243
dotnet_diagnostic.rcs1251.severity = error # RCS1251: Remove unnecessary braces from record declaration https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1251
dotnet_diagnostic.rcs1259.severity = error # RCS1259: Remove empty syntax https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1259
dotnet_diagnostic.rcs1261.severity = error # RCS1261: Resource can be disposed asynchronously https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1261/
dotnet_diagnostic.rcs1262.severity = error # RCS1262: Unnecessary raw string literal https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1262
dotnet_diagnostic.rcs1263.severity = error # RCS1263: Invalid reference in a documentation comment https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1263
dotnet_diagnostic.rcs1266.severity = error # RCS1266: Use raw string literal https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1266
roslynator_block_braces_style = single_line_when_empty
[{**Endpoint.cs,**Controller.cs,**Hub*}]
dotnet_diagnostic.rcs1046.severity = none # RCS1046: Asynchronous method name should end with 'Async' https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1046
@kurnakovv
Copy link
Author

Roslynator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment