|
1 |
| -; What is EditorConfig? http://editorconfig.org/ |
2 |
| - |
3 |
| -root = true |
4 |
| - |
5 |
| -; use tabs identation for all files |
6 |
| -[*] |
7 |
| -indent_style = tab |
8 |
| -insert_final_newline = true |
| 1 | +# EditorConfig is awesome: https://EditorConfig.org |
| 2 | + |
| 3 | +root = true |
| 4 | + |
| 5 | +[*] |
| 6 | +indent_style = tab |
| 7 | +indent_size = 4 |
| 8 | +insert_final_newline = true |
| 9 | +end_of_line = crlf |
| 10 | + |
| 11 | +# Code files |
| 12 | +[*.{cs,csx,vb,vbx}] |
| 13 | +charset = utf-8-bom |
| 14 | + |
| 15 | +# XML project files |
| 16 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 17 | + |
| 18 | +# XML config files |
| 19 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 20 | + |
| 21 | +# JSON files |
| 22 | +[*.json] |
| 23 | + |
| 24 | +# Powershell files |
| 25 | +[*.ps1] |
| 26 | + |
| 27 | +# Azure files |
| 28 | +[*.{yml,sh,cmd,md}] |
| 29 | +indent_style = space |
| 30 | + |
| 31 | +# Azure files |
| 32 | +[*.sh] |
| 33 | +end_of_line = lf |
| 34 | + |
| 35 | + |
| 36 | +# Dotnet code style settings: |
| 37 | +[*.{cs,vb}] |
| 38 | + |
| 39 | +# Sort using and Import directives with System.* appearing first |
| 40 | +dotnet_sort_system_directives_first = true |
| 41 | +dotnet_separate_import_directive_groups = false |
| 42 | + |
| 43 | +# Avoid "this." and "Me." if not necessary |
| 44 | +dotnet_style_qualification_for_field = false:refactoring |
| 45 | +dotnet_style_qualification_for_property = false:refactoring |
| 46 | +dotnet_style_qualification_for_method = false:refactoring |
| 47 | +dotnet_style_qualification_for_event = false:refactoring |
| 48 | + |
| 49 | +# Use language keywords instead of framework type names for type references |
| 50 | +dotnet_style_predefined_type_for_locals_parameters_members = true:error |
| 51 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 52 | + |
| 53 | +# Suggest more modern language features when available |
| 54 | +dotnet_style_object_initializer = true:suggestion |
| 55 | +dotnet_style_collection_initializer = true:suggestion |
| 56 | +dotnet_style_coalesce_expression = true:suggestion |
| 57 | +dotnet_style_null_propagation = true:suggestion |
| 58 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 59 | + |
| 60 | +# CSharp code style settings: |
| 61 | +[*.cs] |
| 62 | +# Newline settings |
| 63 | +csharp_new_line_before_open_brace = all |
| 64 | +csharp_new_line_before_else = true |
| 65 | +csharp_new_line_before_catch = true |
| 66 | +csharp_new_line_before_finally = true |
| 67 | +csharp_new_line_before_members_in_object_initializers = true |
| 68 | +csharp_new_line_before_members_in_anonymous_types = true |
| 69 | +csharp_new_line_between_query_expression_clauses = true |
| 70 | + |
| 71 | +# Indentation preferences |
| 72 | +csharp_indent_block_contents = true |
| 73 | +csharp_indent_braces = false |
| 74 | +csharp_indent_case_contents = true |
| 75 | +csharp_indent_case_contents_when_block = false |
| 76 | +csharp_indent_switch_labels = true |
| 77 | +csharp_indent_labels = flush_left |
| 78 | + |
| 79 | +# Spacing options |
| 80 | +csharp_space_around_declaration_statements = ignore |
| 81 | + |
| 82 | +# Prefer "var" everywhere |
| 83 | +csharp_style_var_for_built_in_types = true:suggestion |
| 84 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 85 | +csharp_style_var_elsewhere = true:suggestion |
| 86 | + |
| 87 | +# Prefer method-like constructs to have a block body |
| 88 | +csharp_style_expression_bodied_methods = false:none |
| 89 | +csharp_style_expression_bodied_constructors = false:none |
| 90 | +csharp_style_expression_bodied_operators = false:none |
| 91 | + |
| 92 | +# Prefer property-like constructs to have an expression-body |
| 93 | +csharp_style_expression_bodied_properties = true:warning |
| 94 | +csharp_style_expression_bodied_indexers = true:warning |
| 95 | +csharp_style_expression_bodied_accessors = true:warning |
| 96 | + |
| 97 | +# Suggest more modern language features when available |
| 98 | +csharp_style_pattern_matching_over_is_with_cast_check = true:warning |
| 99 | +csharp_style_pattern_matching_over_as_with_null_check = true:warning |
| 100 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 101 | +csharp_style_throw_expression = true:suggestion |
| 102 | +csharp_style_conditional_delegate_call = true:suggestion |
| 103 | + |
| 104 | +# Blocks are allowed |
| 105 | +csharp_prefer_braces = true:silent |
| 106 | +csharp_preserve_single_line_blocks = true |
| 107 | +csharp_preserve_single_line_statements = true |
| 108 | + |
| 109 | +csharp_prefer_simple_using_statement = false:silent |
| 110 | +csharp_style_prefer_switch_expression = true:warning |
| 111 | + |
| 112 | +dotnet_style_prefer_compound_assignment = true:warning |
| 113 | + |
| 114 | +[*.{cs,vb}] |
| 115 | +############# |
| 116 | +# Analyzers # |
| 117 | +############# |
| 118 | + |
| 119 | +# general settings applied to all source files |
| 120 | +# Source folder contains additional .editorconfig with overrides |
| 121 | +# |
| 122 | +# enable all analyzers by default |
| 123 | +# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ |
| 124 | +dotnet_analyzer_diagnostic.severity = error |
| 125 | +dotnet_code_quality.api_surface = all |
| 126 | +dotnet_code_quality.enable_platform_analyzer_on_pre_net5_target = true |
| 127 | + |
| 128 | +############################################## |
| 129 | +# active diagnostics (explicitly configured) # |
| 130 | +############################################## |
| 131 | + |
| 132 | +dotnet_diagnostic.CA1825.severity = error # CA1825: Avoid zero-length array allocations |
| 133 | +# generates a lot of noise in tests, enabled in source .editorconfig |
| 134 | +dotnet_diagnostic.CA2007.severity = none # CA2007: Do not directly await a Task |
| 135 | +dotnet_diagnostic.CA2012.severity = error # CA2012: Use ValueTasks correctly |
| 136 | +dotnet_diagnostic.CA2016.severity = error # CA2016: Forward the CancellationToken parameter to methods that take one |
| 137 | +dotnet_diagnostic.CA1018.severity = error # CA1018: Mark attributes with AttributeUsageAttribute |
| 138 | +dotnet_diagnostic.CA1200.severity = error # CA1200: Avoid using cref tags with a prefix |
| 139 | +dotnet_diagnostic.CA1507.severity = error # CA1507: Use nameof in place of string |
| 140 | +dotnet_diagnostic.CA1725.severity = error # CA1725: Parameter names should match base declaration |
| 141 | +dotnet_diagnostic.CA1805.severity = error # CA1805: Do not initialize unnecessarily |
| 142 | +# not interested |
| 143 | +dotnet_diagnostic.CA1816.severity = none # CA1816: Call GC.SuppressFinalize correctly |
| 144 | +dotnet_diagnostic.CA1826.severity = error # CA1826: Use property instead of Linq Enumerable method |
| 145 | +# reported for valid test linq code, rule enabled in source .editorconfig |
| 146 | +dotnet_diagnostic.CA1827.severity = none # CA1827: Do not use Count/LongCount when Any can be used |
| 147 | +# reported for valid test linq code, rule enabled in source .editorconfig |
| 148 | +dotnet_diagnostic.CA1829.severity = none # CA1829: Use Length/Count property instead of Enumerable.Count method |
| 149 | +dotnet_diagnostic.CA1830.severity = error # CA1830: Prefer strongly-typed Append and Insert method overloads on StringBuilder |
| 150 | +dotnet_diagnostic.CA1834.severity = error # CA1834: Use StringBuilder.Append(char) for single character strings |
| 151 | +dotnet_diagnostic.CA1836.severity = error # CA1836: Prefer IsEmpty over Count when available |
| 152 | +dotnet_diagnostic.CA2101.severity = error # CA2101: Specify marshaling for P/Invoke string arguments |
| 153 | +dotnet_diagnostic.CA2200.severity = error # CA2200: Rethrow to preserve stack details |
| 154 | +dotnet_diagnostic.CA2201.severity = error # CA2201: Do not raise reserved exception types |
| 155 | +dotnet_diagnostic.CA2208.severity = error # CA2208: Instantiate argument exceptions correctly |
| 156 | +dotnet_diagnostic.CA2215.severity = error # CA2215: Dispose methods should call base class dispose |
| 157 | +# not interested |
| 158 | +dotnet_diagnostic.CA2231.severity = none # CA2231: Overload operator equals on overriding ValueType.Equals |
| 159 | +# disabled, as NETFX doesn't have string.Contains overloads with comparison type |
| 160 | +dotnet_diagnostic.CA2249.severity = none # CA2249: Consider using String.Contains instead of String.IndexOf |
| 161 | +dotnet_diagnostic.CA3075.severity = error # CA3075: Insecure DTD Processing |
| 162 | + |
| 163 | +######################################################################################################### |
| 164 | +# inactive diagnostics (not reviewed yet => disabled to not fail build, basically TODO list for future) # |
| 165 | +######################################################################################################### |
| 166 | +dotnet_diagnostic.CA1000.severity = none # CA1000: Do not declare static members on generic types |
| 167 | +dotnet_diagnostic.CA1001.severity = none # CA1001: Types that own disposable fields should be disposable |
| 168 | +dotnet_diagnostic.CA1010.severity = none # CA1010: Collections should implement generic interface |
| 169 | +dotnet_diagnostic.CA1050.severity = none # CA1050: Declare types in namespaces |
| 170 | +dotnet_diagnostic.CA1036.severity = none # CA1036: Override methods on comparable types |
| 171 | +dotnet_diagnostic.CA1051.severity = none # CA1051: Do not declare visible instance fields |
| 172 | +dotnet_diagnostic.CA1067.severity = none # CA1067: Override Equals when implementing IEquatable |
| 173 | +dotnet_diagnostic.CA1068.severity = none # CA1068: CancellationToken parameters must come last |
| 174 | +dotnet_diagnostic.CA1069.severity = none # CA1069: Enums should not have duplicate values |
| 175 | +dotnet_diagnostic.CA1304.severity = none # CA1304: Specify CultureInfo |
| 176 | +dotnet_diagnostic.CA1305.severity = none # CA1305: Specify IFormatProvider |
| 177 | +dotnet_diagnostic.CA1309.severity = none # CA1309: Use ordinal StringComparison |
| 178 | +dotnet_diagnostic.CA1310.severity = none # CA1310: Specify StringComparison for correctness |
| 179 | +dotnet_diagnostic.CA1707.severity = none # CA1707: Identifiers should not contain underscores |
| 180 | +dotnet_diagnostic.CA1708.severity = none # CA1708: Identifiers should differ by more than case |
| 181 | +dotnet_diagnostic.CA1711.severity = none # CA1711: Identifiers should not have incorrect suffix |
| 182 | +dotnet_diagnostic.CA1715.severity = none # CA1715: Identifiers should have correct prefix |
| 183 | +dotnet_diagnostic.CA1716.severity = none # CA1716: Identifiers should not match keywords |
| 184 | +dotnet_diagnostic.CA1720.severity = none # CA1720: Identifiers should not contain type names |
| 185 | +dotnet_diagnostic.CA1806.severity = none # CA1806: Do not ignore method results |
| 186 | +dotnet_diagnostic.CA1822.severity = none # CA1822: Mark members as static |
| 187 | +dotnet_diagnostic.CA2211.severity = none # CA2211: Non-constant fields should not be visible |
| 188 | + |
| 189 | +################ |
| 190 | +# VS analyzers # |
| 191 | +################ |
| 192 | +# IDE0051: Remove unused private members |
| 193 | +dotnet_diagnostic.IDE0051.severity = warning |
| 194 | + |
| 195 | +# IDE0055: Fix whitespace formatting |
| 196 | +dotnet_diagnostic.IDE0055.severity = none |
| 197 | + |
| 198 | +# IDE0057: Use range operators (requires .net core 3 or higher) |
| 199 | +dotnet_diagnostic.IDE0056.severity = none |
| 200 | +dotnet_diagnostic.IDE0057.severity = none |
| 201 | + |
| 202 | +# IDE0060: unused parameters should be removed or have a discard symbol name |
| 203 | +dotnet_diagnostic.IDE0060.severity = none |
| 204 | + |
| 205 | +# CS1998: Async method lacks 'await' operators and will run synchronously |
| 206 | +dotnet_diagnostic.CS1998.severity = error |
| 207 | + |
| 208 | +# CS8618: Non-nullable field is uninitialized. Consider declaring as nullable. |
| 209 | +dotnet_diagnostic.CS8618.severity = error |
| 210 | + |
| 211 | +# CS4014: Because this call is not awaited, execution of the current method continues before the call is completed |
| 212 | +dotnet_diagnostic.CS4014.severity = error |
| 213 | + |
| 214 | +dotnet_diagnostic.IDE0058.severity = none # IDE0058: Expression value is never used |
| 215 | +dotnet_diagnostic.IDE0040.severity = none # IDE0040: Add accessibility modifiers |
| 216 | +dotnet_diagnostic.IDE0046.severity = suggestion # IDE0046: Convert to conditional expression |
| 217 | +dotnet_diagnostic.IDE0065.severity = none # IDE0065: Misplaced using directive |
| 218 | +dotnet_diagnostic.IDE0011.severity = suggestion # IDE0011: Add braces |
| 219 | +dotnet_diagnostic.IDE0050.severity = suggestion # IDE0050: Convert to tuple |
| 220 | +dotnet_diagnostic.IDE0072.severity = suggestion # IDE0072: Add missing cases |
| 221 | +dotnet_diagnostic.IDE0054.severity = suggestion # IDE0054: Use compound assignment |
| 222 | +dotnet_diagnostic.IDE0010.severity = suggestion # IDE0010: Add missing cases |
| 223 | +dotnet_diagnostic.IDE0066.severity = suggestion # IDE0066: Convert switch statement to expression |
| 224 | +dotnet_diagnostic.IDE0007.severity = suggestion # IDE0007: Use implicit type |
0 commit comments