Browse Source

Add editorconfig

habeebweeb 1 year ago
parent
commit
e199d77af5
1 changed files with 165 additions and 0 deletions
  1. 165 0
      .editorconfig

+ 165 - 0
.editorconfig

@@ -0,0 +1,165 @@
+# root = true
+
+# Severities:
+#  error (error)
+#  warning (warning)
+#  suggestion (info)
+#  silent (hint)
+#  none (suppressed)
+#  default
+
+[*]
+indent_style = space
+end_of_line = lf
+charset = utf-8
+
+# XML project files
+[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
+indent_size = 2
+
+# XML config files
+[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
+indent_size = 2
+
+# Csharp files
+[*.{cs,csx,vb,vbx}]
+indent_size = 4
+tab_width = 4
+insert_final_newline = true
+
+# Coding style
+[*.cs]
+
+### Language Rules ###
+
+## 'this' and 'Me' preferences (IDE0003 and IDE0009) ##
+dotnet_style_qualification_for_field = false
+dotnet_style_qualification_for_property = false
+dotnet_style_qualification_for_method = false
+dotnet_style_qualification_for_event = false
+
+## Use language keywords instead of framework type names for type references (IDE0049) ##
+dotnet_style_predefined_type_for_locals_parameters_members = true
+dotnet_style_predefined_type_for_member_access = true
+
+## Modifier Preferences ##
+csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:silent
+dotnet_style_require_accessibility_modifiers = for_non_interface_members
+dotnet_style_readonly_field = true
+csharp_prefer_static_local_function = true
+# Make struct fields writable (IDE0064)
+dotnet_diagnostic.IDE0064.severity = warning
+
+## Parentheses preferences (IDE0047 and IDE0048) ##
+dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
+dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary
+dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary
+
+## Expression-level preferences ##
+# Add missing cases to switch statement
+dotnet_diagnostic.IDE0010.severity = silent
+dotnet_style_object_initializer = true
+dotnet_style_collection_initializer = true
+dotnet_style_prefer_auto_properties = true
+dotnet_style_explicit_tuple_names = true
+dotnet_style_prefer_inferred_tuple_names = true
+dotnet_style_prefer_inferred_anonymous_type_member_names = true
+dotnet_style_prefer_conditional_expression_over_assignment = true
+dotnet_style_prefer_conditional_expression_over_return = true
+dotnet_style_prefer_compound_assignment = true
+# Use 'System.HashCode.Combine'
+# dotnet_diagnostic.IDE0070.severity = suggestion
+dotnet_style_prefer_simplified_interpolation = true
+dotnet_style_prefer_simplified_boolean_expressions = true
+# Convert typeof to nameof
+# dotnet_diagnostic.IDE0082.severity = warning
+csharp_style_inlined_variable_declaration = true
+csharp_prefer_simple_default_expression = true
+# was csharp_style_pattern_local_over_anonymous_function
+csharp_style_prefer_local_over_anonymous_function = true
+csharp_style_deconstructed_variable_declaration = true
+csharp_style_prefer_index_operator = true
+csharp_style_prefer_range_operator = true
+csharp_style_implicit_object_creation_when_type_is_apparent = true
+
+## Null-checking preferences ##
+dotnet_style_coalesce_expression = true
+dotnet_style_null_propagation = true
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true
+
+# NOTE: These two don't work
+csharp_style_throw_expression = true
+csharp_style_conditional_delegate_call = true
+
+## Require file header (IDE0073) ##
+file_header_template = unset
+
+## 'var' preferences (IDE0007 and IDE0008) ##
+csharp_style_var_for_built_in_types = true
+csharp_style_var_when_type_is_apparent = true
+csharp_style_var_elsewhere = true
+
+## Expression-bodied-members ##
+csharp_style_expression_bodied_constructors = true
+csharp_style_expression_bodied_methods = true
+csharp_style_expression_bodied_operators = true
+csharp_style_expression_bodied_properties = true
+csharp_style_expression_bodied_indexers = true
+csharp_style_expression_bodied_accessors = true
+csharp_style_expression_bodied_lambdas = true
+csharp_style_expression_bodied_local_functions = true
+
+## Pattern matching preferences ##
+csharp_style_pattern_matching_over_as_with_null_check = true
+csharp_style_pattern_matching_over_is_with_cast_check = true
+csharp_style_prefer_switch_expression = true
+csharp_style_prefer_pattern_matching = true
+csharp_style_prefer_not_pattern = true
+
+## Code block preferences ##
+csharp_prefer_braces = false:suggestion
+csharp_prefer_simple_using_statement = true
+
+## 'using' directive preferences ##
+csharp_using_directive_placement = outside_namespace
+
+### Unnecessary Code Rules ###
+csharp_style_unused_value_expression_statement_preference = discard_variable
+# Remove unnecessary expression value
+dotnet_diagnostic.IDE0058.severity = none
+csharp_style_unused_value_assignment_preference = discard_variable
+dotnet_code_quality_unused_parameters = all
+
+### Formatting Rules ###
+
+## Organize usings ##
+dotnet_sort_system_directives_first = true
+dotnet_separate_import_directive_groups = false
+
+## Namespace options ##
+dotnet_style_namespace_match_folder = true
+csharp_style_namespace_declarations = file_scoped
+
+### Undocumented Rules ###
+
+# prefer is null rather than is {}
+csharp_style_prefer_null_check_over_type_check = true
+
+# prefer (a, b) = (b, a)
+csharp_style_prefer_tuple_swap = true
+
+# prefer e is MethodCallExpression { Method.Name: "MethodName" }
+csharp_style_prefer_extended_property_pattern = true
+
+# options are (end|beginning)_of_line
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+
+csharp_style_prefer_method_group_conversion = true
+
+## Experimental Rules ##
+dotnet_style_allow_statement_immediately_after_block_experimental = false
+dotnet_style_allow_multiple_blank_lines_experimental = false
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
+csharp_style_allow_embedded_statements_on_same_line_experimental = false