-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NFC: enforce more C# code style + enable it in Visual Studio (#1687)
- Loading branch information
Showing
11 changed files
with
150 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,111 @@ | ||
root = true | ||
|
||
[*.cs] | ||
csharp_using_directive_placement = inside_namespace | ||
csharp_style_namespace_declarations = file_scoped | ||
csharp_using_directive_placement = inside_namespace:warning | ||
csharp_style_namespace_declarations = file_scoped:warning | ||
csharp_prefer_simple_using_statement = true:warning | ||
csharp_prefer_braces = true:silent | ||
csharp_style_prefer_method_group_conversion = true:silent | ||
csharp_style_prefer_top_level_statements = true:silent | ||
csharp_style_prefer_primary_constructors = true:warning | ||
csharp_style_expression_bodied_methods = when_on_single_line:silent | ||
csharp_style_expression_bodied_constructors = when_on_single_line:silent | ||
csharp_style_expression_bodied_operators = when_on_single_line:silent | ||
csharp_style_expression_bodied_properties = when_on_single_line:silent | ||
csharp_style_expression_bodied_indexers = when_on_single_line:silent | ||
csharp_style_expression_bodied_accessors = when_on_single_line:silent | ||
csharp_style_expression_bodied_lambdas = when_on_single_line:silent | ||
csharp_style_expression_bodied_local_functions = when_on_single_line:silent | ||
csharp_indent_labels = one_less_than_current | ||
csharp_style_inlined_variable_declaration = true:warning | ||
csharp_style_deconstructed_variable_declaration = true:suggestion | ||
csharp_style_var_for_built_in_types = true:warning | ||
csharp_style_var_when_type_is_apparent = true:warning | ||
csharp_style_var_elsewhere = true:suggestion | ||
csharp_style_prefer_extended_property_pattern = true:suggestion | ||
csharp_style_prefer_not_pattern = true:suggestion | ||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion | ||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion | ||
csharp_style_prefer_pattern_matching = true:warning | ||
csharp_style_prefer_switch_expression = true:warning | ||
csharp_style_conditional_delegate_call = true:warning | ||
csharp_style_prefer_readonly_struct_member = true:warning | ||
csharp_style_prefer_readonly_struct = true:warning | ||
csharp_prefer_static_anonymous_function = true:suggestion | ||
csharp_prefer_static_local_function = true:suggestion | ||
csharp_space_around_binary_operators = before_and_after | ||
|
||
[*.{cs,vb}] | ||
#### Naming styles #### | ||
|
||
# Naming rules | ||
|
||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion | ||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface | ||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i | ||
|
||
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion | ||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types | ||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case | ||
|
||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion | ||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members | ||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case | ||
|
||
# Symbol specifications | ||
|
||
dotnet_naming_symbols.interface.applicable_kinds = interface | ||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected | ||
dotnet_naming_symbols.interface.required_modifiers = | ||
|
||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum | ||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected | ||
dotnet_naming_symbols.types.required_modifiers = | ||
|
||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method | ||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected | ||
dotnet_naming_symbols.non_field_members.required_modifiers = | ||
|
||
# Naming styles | ||
|
||
dotnet_naming_style.begins_with_i.required_prefix = I | ||
dotnet_naming_style.begins_with_i.required_suffix = | ||
dotnet_naming_style.begins_with_i.word_separator = | ||
dotnet_naming_style.begins_with_i.capitalization = pascal_case | ||
|
||
dotnet_naming_style.pascal_case.required_prefix = | ||
dotnet_naming_style.pascal_case.required_suffix = | ||
dotnet_naming_style.pascal_case.word_separator = | ||
dotnet_naming_style.pascal_case.capitalization = pascal_case | ||
|
||
dotnet_naming_style.pascal_case.required_prefix = | ||
dotnet_naming_style.pascal_case.required_suffix = | ||
dotnet_naming_style.pascal_case.word_separator = | ||
dotnet_naming_style.pascal_case.capitalization = pascal_case | ||
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_auto_properties = true:silent | ||
dotnet_style_object_initializer = true:suggestion | ||
dotnet_style_collection_initializer = true:suggestion | ||
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion | ||
dotnet_style_prefer_conditional_expression_over_assignment = true:silent | ||
dotnet_style_prefer_conditional_expression_over_return = true:silent | ||
dotnet_style_explicit_tuple_names = true:suggestion | ||
dotnet_style_operator_placement_when_wrapping = beginning_of_line | ||
tab_width = 4 | ||
indent_size = 4 | ||
dotnet_style_qualification_for_event = false:silent | ||
dotnet_style_qualification_for_method = false:silent | ||
dotnet_style_qualification_for_property = false:silent | ||
dotnet_style_qualification_for_field = false:silent | ||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent | ||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent | ||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent | ||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent | ||
dotnet_code_quality_unused_parameters = all:suggestion | ||
dotnet_style_require_accessibility_modifiers = all:silent | ||
dotnet_style_namespace_match_folder = true:suggestion | ||
|
||
# https://csharpier.com/docs/IntegratingWithLinters | ||
dotnet_diagnostic.IDE0055.severity = none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
214eb7e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmarking failed. Please check the workflow run for details.
214eb7e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmarking failed. Please check the workflow run for details.