|
| 1 | +# IDE0003 and IDE0009: this and Me preferences (option defaults are already false) |
| 2 | +dotnet_style_qualification_for_field = false |
| 3 | +dotnet_style_qualification_for_property = false |
| 4 | +dotnet_style_qualification_for_method = false |
| 5 | +dotnet_style_qualification_for_event = false |
| 6 | +dotnet_diagnostic.IDE0003.severity = warning |
| 7 | + |
| 8 | +# IDE0005: Remove unnecessary imports |
| 9 | +dotnet_diagnostic.IDE0005.severity = warning |
| 10 | + |
| 11 | +# IDE0011: Add braces |
| 12 | +dotnet_diagnostic.IDE0011.severity = none |
| 13 | + |
| 14 | +# IDE0016: Use throw expression |
| 15 | +dotnet_diagnostic.IDE0016.severity = warning |
| 16 | + |
| 17 | +# IDE0017: Use object initializers |
| 18 | +dotnet_style_object_initializer = true |
| 19 | +dotnet_diagnostic.IDE0017.severity = warning |
| 20 | + |
| 21 | +# IDE0018: Inline variable declaration |
| 22 | +dotnet_diagnostic.IDE0018.severity = warning |
| 23 | + |
| 24 | +# IDE0020 and IDE0038: Use pattern matching to avoid is check followed by a cast |
| 25 | +csharp_style_pattern_matching_over_is_with_cast_check = true |
| 26 | +csharp_style_pattern_matching_over_as_with_null_check = true |
| 27 | +dotnet_diagnostic.IDE0020.severity = warning |
| 28 | +dotnet_diagnostic.IDE0038.severity = warning |
| 29 | + |
| 30 | +# IDE0022: Use expression body for methods |
| 31 | +csharp_style_expression_bodied_methods = true |
| 32 | +csharp_style_expression_bodied_constructors = true |
| 33 | +csharp_style_expression_bodied_operators = true |
| 34 | +csharp_style_expression_bodied_properties = true |
| 35 | +csharp_style_expression_bodied_indexers = true |
| 36 | +csharp_style_expression_bodied_accessors = true |
| 37 | +csharp_style_expression_bodied_lambdas = true |
| 38 | +csharp_style_expression_bodied_local_functions = true |
| 39 | +dotnet_diagnostic.IDE0022.severity = warning |
| 40 | + |
| 41 | +# IDE0028: Use collection initializers or expressions |
| 42 | +# IDE0300: Use collection expression for array |
| 43 | +# IDE0301: Use collection expression for empty |
| 44 | +# IDE0302: Use collection expression for stackalloc |
| 45 | +# IDE0303: Use collection expression for Create() |
| 46 | +# IDE0304: Use collection expression for builder |
| 47 | +# IDE0305: Use collection expression for fluent |
| 48 | +# IDE0306: Use collection expression for new |
| 49 | +dotnet_style_collection_initializer = true |
| 50 | +dotnet_style_prefer_collection_expression = when_types_exactly_match |
| 51 | +dotnet_diagnostic.IDE0028.severity = none |
| 52 | +dotnet_diagnostic.IDE0300.severity = none |
| 53 | +dotnet_diagnostic.IDE0301.severity = none |
| 54 | +dotnet_diagnostic.IDE0302.severity = none |
| 55 | +dotnet_diagnostic.IDE0303.severity = none |
| 56 | +dotnet_diagnostic.IDE0304.severity = none |
| 57 | +dotnet_diagnostic.IDE0305.severity = none |
| 58 | +dotnet_diagnostic.IDE0306.severity = none |
| 59 | + |
| 60 | +# IDE0029: Null check can be simplified (ternary conditional check) |
| 61 | +# IDE0030: Null check can be simplified (nullable ternary conditional check) |
| 62 | +# IDE0270: Null check can be simplified (if null check) |
| 63 | +dotnet_style_coalesce_expression = true |
| 64 | +dotnet_diagnostic.IDE0029.severity = warning |
| 65 | +dotnet_diagnostic.IDE0030.severity = warning |
| 66 | +dotnet_diagnostic.IDE0270.severity = warning |
| 67 | + |
| 68 | +# IDE0031: Use null propagation |
| 69 | +dotnet_style_null_propagation = true |
| 70 | +dotnet_diagnostic.IDE0031.severity = warning |
| 71 | + |
| 72 | +# IDE0032: Use auto-implemented property |
| 73 | +dotnet_style_prefer_auto_properties = true |
| 74 | +dotnet_diagnostic.IDE0032.severity = warning |
| 75 | + |
| 76 | +# IDE0033: Use explicitly provided tuple name |
| 77 | +dotnet_style_explicit_tuple_names = true |
| 78 | +dotnet_diagnostic.IDE0033.severity = warning |
| 79 | + |
| 80 | +# IDE0034: Simplify 'default' expression |
| 81 | +csharp_prefer_simple_default_expression = true |
| 82 | +dotnet_diagnostic.IDE0034.severity = warning |
| 83 | + |
| 84 | +# IDE0036: Order modifiers |
| 85 | +# IDE0040: Add accessibility modifiers |
| 86 | +csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async |
| 87 | +dotnet_diagnostic.IDE0036.severity = warning |
| 88 | +dotnet_diagnostic.IDE0040.severity = warning |
| 89 | + |
| 90 | +# IDE0037: Use inferred member names |
| 91 | +dotnet_style_prefer_inferred_tuple_names = true |
| 92 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true |
| 93 | +dotnet_diagnostic.IDE0037.severity = warning |
| 94 | + |
| 95 | +# IDE0040: Add accessibility modifiers |
| 96 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members |
| 97 | +dotnet_diagnostic.IDE0040.severity = warning |
| 98 | + |
| 99 | +# IDE0041: Use 'is null' check |
| 100 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true |
| 101 | +dotnet_diagnostic.IDE0041.severity = warning |
| 102 | + |
| 103 | +# IDE0044: Add readonly modifier |
| 104 | +dotnet_style_readonly_field = true |
| 105 | +dotnet_diagnostic.IDE0044.severity = warning |
| 106 | + |
| 107 | +# IDE0045: Use conditional expression for assignment |
| 108 | +dotnet_style_prefer_conditional_expression_over_assignment = true |
| 109 | +dotnet_diagnostic.IDE0045.severity = none |
| 110 | + |
| 111 | +# IDE0046: Use conditional expression for return |
| 112 | +dotnet_style_prefer_conditional_expression_over_return = true |
| 113 | +dotnet_diagnostic.IDE0046.severity = none |
| 114 | + |
| 115 | +# IDE0049: Use language keywords instead of framework type names for type references |
| 116 | +# Default is already true. This rule is not enabled on build. |
| 117 | +dotnet_style_predefined_type_for_locals_parameters_members = true |
| 118 | +dotnet_style_predefined_type_for_member_access = true |
| 119 | +dotnet_diagnostic.IDE0049.severity = warning |
| 120 | + |
| 121 | +# IDE0055: Fix formatting |
| 122 | +dotnet_diagnostic.IDE0055.severity = warning |
| 123 | + |
| 124 | +# .NET formatting options - IDE0055 |
| 125 | +dotnet_sort_system_directives_first = true |
| 126 | +dotnet_separate_import_directive_groups = false |
| 127 | + |
| 128 | +# New line preferences - IDE0055 |
| 129 | +csharp_new_line_before_open_brace = all |
| 130 | +csharp_new_line_before_else = true |
| 131 | +csharp_new_line_before_catch = true |
| 132 | +csharp_new_line_before_finally = true |
| 133 | +csharp_new_line_before_members_in_object_initializers = true |
| 134 | +csharp_new_line_before_members_in_anonymous_types = true |
| 135 | +csharp_new_line_between_query_expression_clauses = true |
| 136 | + |
| 137 | +# Indentation preferences - IDE0055 |
| 138 | +csharp_indent_block_contents = true |
| 139 | +csharp_indent_braces = false |
| 140 | +csharp_indent_case_contents = true |
| 141 | +csharp_indent_case_contents_when_block = false |
| 142 | +csharp_indent_switch_labels = true |
| 143 | +csharp_indent_labels = one_less_than_current |
| 144 | + |
| 145 | +# Spacing preferences - IDE0055 |
| 146 | +csharp_space_after_cast = false |
| 147 | +csharp_space_after_colon_in_inheritance_clause = true |
| 148 | +csharp_space_after_comma = true |
| 149 | +csharp_space_after_dot = false |
| 150 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 151 | +csharp_space_after_semicolon_in_for_statement = true |
| 152 | +csharp_space_around_binary_operators = before_and_after |
| 153 | +csharp_space_around_declaration_statements = do_not_ignore |
| 154 | +csharp_space_before_colon_in_inheritance_clause = true |
| 155 | +csharp_space_before_comma = false |
| 156 | +csharp_space_before_dot = false |
| 157 | +csharp_space_before_open_square_brackets = false |
| 158 | +csharp_space_before_semicolon_in_for_statement = false |
| 159 | +csharp_space_between_empty_square_brackets = false |
| 160 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 161 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 162 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 163 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 164 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 165 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 166 | +csharp_space_between_parentheses = false |
| 167 | +csharp_space_between_square_brackets = false |
| 168 | + |
| 169 | +# Wrapping preferences - IDE0055 |
| 170 | +csharp_preserve_single_line_blocks = true |
| 171 | +csharp_preserve_single_line_statements = false |
| 172 | + |
| 173 | +# IDE0056: Use index operator |
| 174 | +csharp_style_prefer_index_operator = false |
| 175 | +dotnet_diagnostic.IDE0056.severity = warning |
| 176 | + |
| 177 | +# IDE0057: Use range operator |
| 178 | +csharp_style_prefer_range_operator = false |
| 179 | +dotnet_diagnostic.IDE0057.severity = warning |
| 180 | + |
| 181 | +# IDE0062: Make local function static |
| 182 | +csharp_prefer_static_local_function = true |
| 183 | +dotnet_diagnostic.IDE0062.severity = warning |
| 184 | + |
| 185 | +# IDE0063: Use simple 'using' statement |
| 186 | +csharp_prefer_simple_using_statement = true |
| 187 | +dotnet_diagnostic.IDE0063.severity = warning |
| 188 | + |
| 189 | +# IDE0066: Use switch expression |
| 190 | +csharp_style_prefer_switch_expression = true |
| 191 | +dotnet_diagnostic.IDE0066.severity = warning |
| 192 | + |
| 193 | +# IDE1006: Naming rule violation |
| 194 | +dotnet_diagnostic.IDE1006.severity = warning |
| 195 | + |
| 196 | +# Naming rules: name all constant fields using PascalCase (IDE1006) |
| 197 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning |
| 198 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields |
| 199 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style |
| 200 | +dotnet_naming_symbols.constant_fields.applicable_kinds = field |
| 201 | +dotnet_naming_symbols.constant_fields.required_modifiers = const |
| 202 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 203 | + |
| 204 | +# Naming rules: static fields should have s_ prefix (IDE1006) |
| 205 | +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion |
| 206 | +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields |
| 207 | +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style |
| 208 | +dotnet_naming_symbols.static_fields.applicable_kinds = field |
| 209 | +dotnet_naming_symbols.static_fields.required_modifiers = static |
| 210 | +dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected |
| 211 | +dotnet_naming_style.static_prefix_style.required_prefix = s_ |
| 212 | +dotnet_naming_style.static_prefix_style.capitalization = camel_case |
| 213 | + |
| 214 | +# Naming rules: internal and private fields should be _camelCase (IDE1006) |
| 215 | +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion |
| 216 | +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields |
| 217 | +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style |
| 218 | +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field |
| 219 | +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal |
| 220 | +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ |
| 221 | +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case |
| 222 | + |
| 223 | +# IDE1005 |
| 224 | +csharp_style_conditional_delegate_call = true |
| 225 | + |
| 226 | + |
| 227 | +# IDE0160 and IDE0161 |
| 228 | +csharp_style_namespace_declarations = file_scoped |
| 229 | + |
| 230 | + |
| 231 | +# CA1014: Mark assemblies with CLSCompliant |
| 232 | +dotnet_diagnostic.CA1014.severity = none |
| 233 | + |
| 234 | +# CA1824: Mark assemblies with NeutralResourcesLanguageAttribute |
| 235 | +dotnet_diagnostic.CA1824.severity = none |
| 236 | + |
| 237 | +# CA1062: Validate arguments of public methods |
| 238 | +dotnet_diagnostic.CA1062.severity = none |
| 239 | + |
| 240 | + |
| 241 | +# TODO: Use YAnalyzers for var vs explicit types. |
0 commit comments