|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +# editorconfig.org |
| 19 | + |
| 20 | +# top-most EditorConfig file |
| 21 | +root = true |
| 22 | + |
| 23 | +# Default settings: |
| 24 | +# A newline ending every file |
| 25 | +# Use 4 spaces as indentation |
| 26 | +[*] |
| 27 | +insert_final_newline = true |
| 28 | +indent_style = space |
| 29 | +indent_size = 4 |
| 30 | +trim_trailing_whitespace = true |
| 31 | +spelling_exclusion_path = ./exclusion.dic |
| 32 | + |
| 33 | +[*.json] |
| 34 | +indent_size = 2 |
| 35 | + |
| 36 | +# Generated code |
| 37 | +[*{_AssemblyInfo.cs,.notsupported.cs,*/obj/*/External/**/*,*/obj/dotnet-new.IntegrationTests/*/TemplatePackagesPaths.cs}] |
| 38 | +generated_code = true |
| 39 | + |
| 40 | +# C# files |
| 41 | +[*.cs] |
| 42 | +# New line preferences |
| 43 | +csharp_new_line_before_open_brace = all |
| 44 | +csharp_new_line_before_else = true |
| 45 | +csharp_new_line_before_catch = true |
| 46 | +csharp_new_line_before_finally = true |
| 47 | +csharp_new_line_before_members_in_object_initializers = true |
| 48 | +csharp_new_line_before_members_in_anonymous_types = true |
| 49 | +csharp_new_line_between_query_expression_clauses = true |
| 50 | + |
| 51 | +# Indentation preferences |
| 52 | +csharp_indent_block_contents = true |
| 53 | +csharp_indent_braces = false |
| 54 | +csharp_indent_case_contents = true |
| 55 | +csharp_indent_case_contents_when_block = false |
| 56 | +csharp_indent_switch_labels = true |
| 57 | +csharp_indent_labels = one_less_than_current |
| 58 | + |
| 59 | +# Modifier preferences |
| 60 | +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion |
| 61 | + |
| 62 | +# avoid this. unless absolutely necessary |
| 63 | +dotnet_style_qualification_for_field = false:suggestion |
| 64 | +dotnet_style_qualification_for_property = false:suggestion |
| 65 | +dotnet_style_qualification_for_method = false:suggestion |
| 66 | +dotnet_style_qualification_for_event = false:suggestion |
| 67 | + |
| 68 | +# Types: use keywords instead of BCL types, and permit var only when the type is clear |
| 69 | +csharp_style_var_for_built_in_types = false:none |
| 70 | +csharp_style_var_when_type_is_apparent = false:none |
| 71 | +csharp_style_var_elsewhere = false:none |
| 72 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 73 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 74 | + |
| 75 | +# name all constant fields using PascalCase |
| 76 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion |
| 77 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields |
| 78 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style |
| 79 | +dotnet_naming_symbols.constant_fields.applicable_kinds = field |
| 80 | +dotnet_naming_symbols.constant_fields.required_modifiers = const |
| 81 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 82 | + |
| 83 | +# static fields should have s_ prefix |
| 84 | +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion |
| 85 | +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields |
| 86 | +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style |
| 87 | +dotnet_naming_symbols.static_fields.applicable_kinds = field |
| 88 | +dotnet_naming_symbols.static_fields.required_modifiers = static |
| 89 | +dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected |
| 90 | +dotnet_naming_style.static_prefix_style.required_prefix = s_ |
| 91 | +dotnet_naming_style.static_prefix_style.capitalization = camel_case |
| 92 | + |
| 93 | +# internal and private fields should be _camelCase |
| 94 | +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion |
| 95 | +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields |
| 96 | +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style |
| 97 | +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field |
| 98 | +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal |
| 99 | +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ |
| 100 | +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case |
| 101 | + |
| 102 | +# Code style defaults |
| 103 | +csharp_using_directive_placement = outside_namespace:suggestion |
| 104 | +dotnet_sort_system_directives_first = true |
| 105 | +csharp_prefer_braces = true:silent |
| 106 | +csharp_preserve_single_line_blocks = true:none |
| 107 | +csharp_preserve_single_line_statements = false:none |
| 108 | +csharp_prefer_static_local_function = true:suggestion |
| 109 | +csharp_prefer_simple_using_statement = false:none |
| 110 | +csharp_style_prefer_switch_expression = true:suggestion |
| 111 | + |
| 112 | +# Code quality |
| 113 | +dotnet_style_readonly_field = true:suggestion |
| 114 | +dotnet_code_quality_unused_parameters = non_public:suggestion |
| 115 | + |
| 116 | +# Expression-level preferences |
| 117 | +dotnet_style_object_initializer = true:suggestion |
| 118 | +dotnet_style_collection_initializer = true:suggestion |
| 119 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 120 | +dotnet_style_coalesce_expression = true:suggestion |
| 121 | +dotnet_style_null_propagation = true:suggestion |
| 122 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 123 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 124 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 125 | +dotnet_style_prefer_auto_properties = true:suggestion |
| 126 | +dotnet_style_prefer_conditional_expression_over_assignment = true:silent |
| 127 | +dotnet_style_prefer_conditional_expression_over_return = true:silent |
| 128 | +csharp_prefer_simple_default_expression = true:suggestion |
| 129 | + |
| 130 | +# Expression-bodied members |
| 131 | +csharp_style_expression_bodied_methods = true:silent |
| 132 | +csharp_style_expression_bodied_constructors = true:silent |
| 133 | +csharp_style_expression_bodied_operators = true:silent |
| 134 | +csharp_style_expression_bodied_properties = true:silent |
| 135 | +csharp_style_expression_bodied_indexers = true:silent |
| 136 | +csharp_style_expression_bodied_accessors = true:silent |
| 137 | +csharp_style_expression_bodied_lambdas = true:silent |
| 138 | +csharp_style_expression_bodied_local_functions = true:silent |
| 139 | + |
| 140 | +# Pattern matching |
| 141 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 142 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 143 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 144 | + |
| 145 | +# Null checking preferences |
| 146 | +csharp_style_throw_expression = true:suggestion |
| 147 | +csharp_style_conditional_delegate_call = true:suggestion |
| 148 | + |
| 149 | +# Other features |
| 150 | +csharp_style_prefer_index_operator = false:none |
| 151 | +csharp_style_prefer_range_operator = false:none |
| 152 | +csharp_style_pattern_local_over_anonymous_function = false:none |
| 153 | + |
| 154 | +# Space preferences |
| 155 | +csharp_space_after_cast = false |
| 156 | +csharp_space_after_colon_in_inheritance_clause = true |
| 157 | +csharp_space_after_comma = true |
| 158 | +csharp_space_after_dot = false |
| 159 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 160 | +csharp_space_after_semicolon_in_for_statement = true |
| 161 | +csharp_space_around_binary_operators = before_and_after |
| 162 | +csharp_space_around_declaration_statements = do_not_ignore |
| 163 | +csharp_space_before_colon_in_inheritance_clause = true |
| 164 | +csharp_space_before_comma = false |
| 165 | +csharp_space_before_dot = false |
| 166 | +csharp_space_before_open_square_brackets = false |
| 167 | +csharp_space_before_semicolon_in_for_statement = false |
| 168 | +csharp_space_between_empty_square_brackets = false |
| 169 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 170 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 171 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 172 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 173 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 174 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 175 | +csharp_space_between_parentheses = false |
| 176 | +csharp_space_between_square_brackets = false |
| 177 | + |
| 178 | +# Default analyzed API surface = 'all' (public APIs + non-public APIs) |
| 179 | +dotnet_code_quality.api_surface = all |
| 180 | + |
| 181 | +# License header |
| 182 | +file_header_template = /*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * "License"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */ |
| 183 | + |
| 184 | +# Code files |
| 185 | +[*.{cs,vb}] |
| 186 | +# Analyzers |
| 187 | +dotnet_code_quality.ca1802.api_surface = private, internal |
| 188 | +dotnet_code_quality.ca1822.api_surface = private, internal |
| 189 | +dotnet_code_quality.ca2208.api_surface = public |
| 190 | +# Mark attributes with AttributeUsageAttribute |
| 191 | +dotnet_diagnostic.CA1018.severity = warning |
| 192 | +# Properties should not be write only |
| 193 | +dotnet_diagnostic.CA1044.severity = warning |
| 194 | +# Do not declare protected member in sealed type |
| 195 | +dotnet_diagnostic.CA1047.severity = warning |
| 196 | +# Avoid using cref tags with a prefix |
| 197 | +dotnet_diagnostic.CA1200.severity = suggestion |
| 198 | +# P/Invokes should not be visible |
| 199 | +dotnet_diagnostic.CA1401.severity = warning |
| 200 | +# Parameter names should match base declaration |
| 201 | +dotnet_diagnostic.CA1725.severity = suggestion |
| 202 | +# Remove empty Finalizers |
| 203 | +dotnet_diagnostic.CA1821.severity = warning |
| 204 | +# Mark assemblies with NeutralResourcesLanguageAttribute |
| 205 | +dotnet_diagnostic.CA1824.severity = warning |
| 206 | +# Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used |
| 207 | +dotnet_diagnostic.CA1828.severity = warning |
| 208 | +# Prefer strongly-typed Append and Insert method overloads on StringBuilder. |
| 209 | +dotnet_diagnostic.CA1830.severity = warning |
| 210 | +# Use AsSpan or AsMemory instead of Range-based indexers when appropriate |
| 211 | +dotnet_diagnostic.CA1832.severity = warning |
| 212 | +# Use AsSpan or AsMemory instead of Range-based indexers when appropriate |
| 213 | +dotnet_diagnostic.CA1833.severity = warning |
| 214 | +# Prefer IsEmpty over Count |
| 215 | +dotnet_diagnostic.CA1836.severity = warning |
| 216 | +# Use 'Environment.ProcessPath' |
| 217 | +dotnet_diagnostic.CA1839.severity = warning |
| 218 | +# Do not call ToImmutableCollection on an ImmutableCollection value |
| 219 | +# Temporarily disable to avoid regression in preview 1, revert back to warning when start using preview 2 |
| 220 | +dotnet_diagnostic.CA2009.severity = none |
| 221 | +# Avoid infinite recursion |
| 222 | +dotnet_diagnostic.CA2011.severity = warning |
| 223 | +# Initialize value type static fields inline |
| 224 | +dotnet_diagnostic.CA2207.severity = warning |
| 225 | +# Implement serialization constructors |
| 226 | +dotnet_diagnostic.CA2229.severity = warning |
| 227 | +# Provide correct arguments to formatting methods |
| 228 | +dotnet_diagnostic.CA2241.severity = warning |
| 229 | +# Test for NaN correctly |
| 230 | +dotnet_diagnostic.CA2242.severity = warning |
| 231 | +# Do not assign a property to itself. |
| 232 | +dotnet_diagnostic.CA2245.severity = warning |
| 233 | +# Provide correct 'enum' argument to 'Enum.HasFlag' |
| 234 | +dotnet_diagnostic.CA2248.severity = warning |
| 235 | +# Do Not Add Schema By URL |
| 236 | +dotnet_diagnostic.CA3061.severity = warning |
| 237 | +# Insecure DTD processing in XML |
| 238 | +dotnet_diagnostic.CA3075.severity = warning |
| 239 | +# Insecure XSLT script processing. |
| 240 | +dotnet_diagnostic.CA3076.severity = warning |
| 241 | +# Insecure Processing in API Design, XmlDocument and XmlTextReader |
| 242 | +dotnet_diagnostic.CA3077.severity = warning |
| 243 | +# Mark Verb Handlers With Validate Antiforgery Token |
| 244 | +dotnet_diagnostic.CA3147.severity = warning |
| 245 | +# Do Not Use Broken Cryptographic Algorithms |
| 246 | +dotnet_diagnostic.CA5351.severity = warning |
| 247 | +# Do Not Disable Certificate Validation |
| 248 | +dotnet_diagnostic.CA5359.severity = warning |
| 249 | +# Do Not Call Dangerous Methods In Deserialization |
| 250 | +dotnet_diagnostic.CA5360.severity = warning |
| 251 | +# Do Not Disable SChannel Use of Strong Crypto |
| 252 | +dotnet_diagnostic.CA5361.severity = warning |
| 253 | +# Do Not Disable Request Validation |
| 254 | +dotnet_diagnostic.CA5363.severity = warning |
| 255 | +# Do Not Use Deprecated Security Protocols |
| 256 | +dotnet_diagnostic.CA5364.severity = warning |
| 257 | +# Do Not Disable HTTP Header Checking |
| 258 | +dotnet_diagnostic.CA5365.severity = warning |
| 259 | +# Set ViewStateUserKey For Classes Derived From Page |
| 260 | +dotnet_diagnostic.CA5368.severity = warning |
| 261 | +# Use XmlReader For Validating Reader |
| 262 | +dotnet_diagnostic.CA5370.severity = warning |
| 263 | +# Do not use obsolete key derivation function |
| 264 | +dotnet_diagnostic.CA5373.severity = warning |
| 265 | +# Do Not Use XslTransform |
| 266 | +dotnet_diagnostic.CA5374.severity = warning |
| 267 | +# Use SharedAccessProtocol HttpsOnly |
| 268 | +dotnet_diagnostic.CA5376.severity = warning |
| 269 | +# Use Container Level Access Policy |
| 270 | +dotnet_diagnostic.CA5377.severity = warning |
| 271 | +# Do not disable ServicePointManagerSecurityProtocols |
| 272 | +dotnet_diagnostic.CA5378.severity = warning |
| 273 | +# Do Not Use Weak Key Derivation Function Algorithm |
| 274 | +dotnet_diagnostic.CA5379.severity = warning |
| 275 | +# Do Not Add Certificates To Root Store |
| 276 | +dotnet_diagnostic.CA5380.severity = warning |
| 277 | +# Ensure Certificates Are Not Added To Root Store |
| 278 | +dotnet_diagnostic.CA5381.severity = warning |
| 279 | +# Do Not Use Digital Signature Algorithm (DSA) |
| 280 | +dotnet_diagnostic.CA5384.severity = warning |
| 281 | +# Use Rivest–Shamir–Adleman (RSA) Algorithm With Sufficient Key Size |
| 282 | +dotnet_diagnostic.CA5385.severity = warning |
| 283 | +dotnet_diagnostic.CS1591.severity = suggestion |
| 284 | +# UseIsNullCheck |
| 285 | +dotnet_diagnostic.IDE0041.severity = warning |
| 286 | +# ValidateFormatString |
| 287 | +dotnet_diagnostic.IDE0043.severity = warning |
| 288 | +# MakeLocalFunctionStatic |
| 289 | +dotnet_diagnostic.IDE0062.severity = warning |
| 290 | +# ConvertTypeOfToNameOf |
| 291 | +dotnet_diagnostic.IDE0082.severity = warning |
| 292 | +# Remove unnecessary lambda expression |
| 293 | +dotnet_diagnostic.IDE0200.severity = none |
| 294 | +# Remove redundant nullable directive |
| 295 | +dotnet_diagnostic.IDE0240.severity = warning |
| 296 | + |
| 297 | +# C++ Files |
| 298 | +[*.{cpp,h,in}] |
| 299 | +curly_bracket_next_line = true |
| 300 | +indent_brace_style = Allman |
| 301 | + |
| 302 | +# Xml project files |
| 303 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] |
| 304 | +indent_size = 2 |
| 305 | + |
| 306 | +[*.{csproj,vbproj,proj,nativeproj,locproj}] |
| 307 | +charset = utf-8-bom |
| 308 | + |
| 309 | +# Xml build files |
| 310 | +[*.builds] |
| 311 | +indent_size = 2 |
| 312 | + |
| 313 | +# Xml files |
| 314 | +[*.{xml,stylecop,resx,ruleset}] |
| 315 | +indent_size = 2 |
| 316 | + |
| 317 | +# Xml config files |
| 318 | +[*.{props,targets,config,nuspec}] |
| 319 | +indent_size = 2 |
| 320 | + |
| 321 | +# YAML config files |
| 322 | +[*.{yml,yaml}] |
| 323 | +indent_size = 2 |
| 324 | + |
| 325 | +# Shell scripts |
| 326 | +[*.sh] |
| 327 | +end_of_line = lf |
| 328 | +[*.{cmd, bat}] |
| 329 | +end_of_line = crlf |
| 330 | + |
| 331 | +# IDE0040: Add accessibility modifiers |
| 332 | +dotnet_diagnostic.IDE0040.severity = warning |
| 333 | + |
| 334 | +[*.txt] |
| 335 | +insert_final_newline = false |
| 336 | + |
| 337 | +# Verify settings |
| 338 | +[*.{received,verified}.{txt,xml,json}] |
| 339 | +charset = "utf-8-bom" |
| 340 | +end_of_line = lf |
| 341 | +indent_size = unset |
| 342 | +indent_style = unset |
| 343 | +insert_final_newline = false |
| 344 | +tab_width = unset |
| 345 | +trim_trailing_whitespace = false |
0 commit comments