Skip to content

Commit

Permalink
align editor config with other libraries (#3079)
Browse files Browse the repository at this point in the history
  • Loading branch information
westin-m authored Oct 11, 2024
1 parent 894905f commit 78719ac
Showing 1 changed file with 43 additions and 12 deletions.
55 changes: 43 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Note: MSAL rules used as a starting point

# editorconfig.org
# Copied from the .NET Core repo https://github.com/dotnet/corefx/blob/master/.editorconfig

# top-most EditorConfig file
root = true
Expand All @@ -13,7 +10,7 @@ root = true
insert_final_newline = true
indent_style = space
indent_size = 4
dotnet_diagnostic.CA1308.severity=warning
trim_trailing_whitespace = true

[project.json]
indent_size = 2
Expand All @@ -33,6 +30,7 @@ csharp_new_line_between_query_expression_clauses = true
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

Expand Down Expand Up @@ -84,24 +82,42 @@ dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case

# Code style defaults
csharp_using_directive_placement = outside_namespace:suggestion
dotnet_sort_system_directives_first = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
csharp_prefer_braces = true:silent
csharp_preserve_single_line_blocks = true:none
csharp_preserve_single_line_statements = false:none
csharp_prefer_static_local_function = true:suggestion
csharp_prefer_simple_using_statement = false:none
csharp_style_prefer_switch_expression = true:suggestion

# Code quality
dotnet_style_readonly_field = true:suggestion
dotnet_code_quality_unused_parameters = non_public:suggestion

# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
csharp_prefer_simple_default_expression = true:suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_constructors = true:silent
csharp_style_expression_bodied_operators = true:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = true:silent

# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
Expand All @@ -112,6 +128,11 @@ csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Other features
csharp_style_prefer_index_operator = false:none
csharp_style_prefer_range_operator = false:none
csharp_style_pattern_local_over_anonymous_function = false:none

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
Expand All @@ -136,6 +157,10 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# Analyzers
dotnet_code_quality.CA1802.api_surface = private, internal
dotnet_code_quality.CA2208.api_surface = public

# Id Web Rules

# RS0030: Do not used banned APIs
Expand Down Expand Up @@ -238,6 +263,9 @@ dotnet_diagnostic.CA1067.severity = error
# CA1068: CancellationToken parameters must come last
dotnet_diagnostic.CA1068.severity = error

# CA1308: Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity=warning

# CA1505: Avoid unmaintainable code
dotnet_diagnostic.CA1505.severity = error

Expand Down Expand Up @@ -558,6 +586,9 @@ indent_brace_style = Allman
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2

[*.{csproj,vbproj,proj,nativeproj,locproj}]
charset = utf-8

# Xml build files
[*.builds]
indent_size = 2
Expand Down

0 comments on commit 78719ac

Please sign in to comment.