yarp-swagger
/
.editorconfig
260 строк · 11.6 Кб
1# Remove the line below if you want to inherit .editorconfig settings from higher directories
2root = true
3
4# C# files
5[*.cs]
6
7# Here we set all microsoft's IDExxxx rule violations as compile errors
8# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/
9dotnet_analyzer_diagnostic.category-Style.severity = error
10
11# Here we ignore some rule violdations that they are not really important for us
12dotnet_diagnostic.IDE0008.severity = silent # Explicit type, not var
13dotnet_diagnostic.IDE0010.severity = silent # missing cases to "case" switch expression
14dotnet_diagnostic.IDE0039.severity = silent # lambda vs local function
15dotnet_diagnostic.IDE0045.severity = silent # Use ternary for assignment, not ifs
16dotnet_diagnostic.IDE0046.severity = silent # Use ternary for returns, not ifs
17dotnet_diagnostic.IDE0055.severity = silent # Generic formatting errors: should be handled by csharpier
18dotnet_diagnostic.IDE0058.severity = silent # Expression value is never used
19dotnet_diagnostic.IDE0072.severity = silent # missing cases to "=>" switch expression
20dotnet_diagnostic.IDE0090.severity = silent # Use implicit new
21dotnet_diagnostic.IDE0270.severity = silent # Simplify null check
22# https://github.com/dotnet/aspnetcore/issues/47912
23dotnet_diagnostic.IDE0005.severity = none # Remove unnecessary using directives (using CS8019 instead)
24dotnet_diagnostic.CS8019.severity = error # Remove unnecessary using directives
25dotnet_diagnostic.CS8618.severity = error # Non-nullable property must contain a non-null value
26
27
28# Here we set some rules for unused codes (classes, methods, parameters, etc.)
29dotnet_diagnostic.CA1801.severity = error # Review unused parameters
30dotnet_diagnostic.CA1804.severity = error # Remove unused locals
31dotnet_diagnostic.CA1811.severity = error # Avoid uncalled private code
32dotnet_diagnostic.CA1823.severity = error # Avoid unused private fields
33
34
35#### Core EditorConfig Options ####
36
37# Indentation and spacing
38indent_size = 4
39indent_style = space
40tab_width = 4
41
42#### .NET Coding Conventions ####
43
44# Organize usings
45dotnet_separate_import_directive_groups = false
46dotnet_sort_system_directives_first = false
47file_header_template = unset
48
49# this. and Me. preferences
50dotnet_style_qualification_for_event = false
51dotnet_style_qualification_for_field = false:error
52dotnet_style_qualification_for_method = false:error
53dotnet_style_qualification_for_property = false:error
54
55# Language keywords vs BCL types preferences
56dotnet_style_predefined_type_for_locals_parameters_members = true
57dotnet_style_predefined_type_for_member_access = true
58
59# Parentheses preferences
60dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
61dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary
62dotnet_style_parentheses_in_other_operators = never_if_unnecessary
63dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary
64
65# Modifier preferences
66dotnet_style_require_accessibility_modifiers = for_non_interface_members
67
68# Expression-level preferences
69dotnet_style_coalesce_expression = true
70dotnet_style_collection_initializer = true
71dotnet_style_explicit_tuple_names = true
72dotnet_style_namespace_match_folder = true
73dotnet_style_null_propagation = true
74dotnet_style_object_initializer = true
75dotnet_style_operator_placement_when_wrapping = beginning_of_line
76dotnet_style_prefer_auto_properties = true
77dotnet_style_prefer_compound_assignment = true
78dotnet_style_prefer_conditional_expression_over_assignment = true
79dotnet_style_prefer_conditional_expression_over_return = true
80dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
81dotnet_style_prefer_inferred_anonymous_type_member_names = true
82dotnet_style_prefer_inferred_tuple_names = true
83dotnet_style_prefer_is_null_check_over_reference_equality_method = true
84dotnet_style_prefer_simplified_boolean_expressions = true
85dotnet_style_prefer_simplified_interpolation = true
86
87# Field preferences
88dotnet_style_readonly_field = true
89
90# Parameter preferences
91dotnet_code_quality_unused_parameters = all
92
93# Suppression preferences
94dotnet_remove_unnecessary_suppression_exclusions = none
95
96# New line preferences
97dotnet_style_allow_multiple_blank_lines_experimental = true
98dotnet_style_allow_statement_immediately_after_block_experimental = true
99
100#### C# Coding Conventions ####
101
102# var preferences
103csharp_style_var_elsewhere = false:silent
104csharp_style_var_for_built_in_types = false:silent
105csharp_style_var_when_type_is_apparent = false:silent
106
107# Expression-bodied members
108csharp_style_expression_bodied_accessors = true:silent
109csharp_style_expression_bodied_constructors = false:silent
110csharp_style_expression_bodied_indexers = true:silent
111csharp_style_expression_bodied_lambdas = true:silent
112csharp_style_expression_bodied_local_functions = false:silent
113csharp_style_expression_bodied_methods = when_on_single_line:none
114csharp_style_expression_bodied_operators = false:silent
115csharp_style_expression_bodied_properties = true:silent
116
117# Pattern matching preferences
118csharp_style_pattern_matching_over_as_with_null_check = false
119csharp_style_pattern_matching_over_is_with_cast_check = false
120csharp_style_prefer_extended_property_pattern = false
121csharp_style_prefer_not_pattern = false
122csharp_style_prefer_pattern_matching = false
123csharp_style_prefer_switch_expression = false
124
125# Null-checking preferences
126csharp_style_conditional_delegate_call = true
127
128# Modifier preferences
129csharp_prefer_static_local_function = true
130csharp_preferred_modifier_order = public, private, protected, internal, file, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, required, volatile, async
131csharp_style_prefer_readonly_struct = true
132
133# Code-block preferences
134csharp_prefer_braces = when_multiline:error
135csharp_prefer_simple_using_statement = false:silent
136csharp_style_namespace_declarations = false:silent
137csharp_style_prefer_method_group_conversion = true:silent
138csharp_style_prefer_top_level_statements = true:silent
139
140# Expression-level preferences
141csharp_prefer_simple_default_expression = true
142csharp_style_deconstructed_variable_declaration = true
143csharp_style_implicit_object_creation_when_type_is_apparent = false
144csharp_style_inlined_variable_declaration = true
145csharp_style_prefer_index_operator = true
146csharp_style_prefer_local_over_anonymous_function = true
147csharp_style_prefer_null_check_over_type_check = true
148csharp_style_prefer_range_operator = true
149csharp_style_prefer_tuple_swap = true
150csharp_style_prefer_utf8_string_literals = true
151csharp_style_throw_expression = true
152csharp_style_unused_value_assignment_preference = discard_variable
153csharp_style_unused_value_expression_statement_preference = discard_variable
154
155# 'using' directive preferences
156csharp_using_directive_placement = outside_namespace:silent
157
158# New line preferences
159csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
160csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
161csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
162csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
163csharp_style_allow_embedded_statements_on_same_line_experimental = true
164
165#### C# Formatting Rules ####
166# All handled by csharpier
167
168#### Naming styles ####
169
170# Naming rules
171
172dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
173dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
174dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
175
176dotnet_naming_rule.types_should_be_pascal_case.severity = error
177dotnet_naming_rule.types_should_be_pascal_case.symbols = types
178dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
179
180dotnet_naming_rule.constant_should_be_capitalized_snake_case.severity = error
181dotnet_naming_rule.constant_should_be_capitalized_snake_case.symbols = constant
182dotnet_naming_rule.constant_should_be_capitalized_snake_case.style = capitalized_snake_case
183
184dotnet_naming_rule.readonly_should_be_begins_with__.severity = error
185dotnet_naming_rule.readonly_should_be_begins_with__.symbols = readonly
186dotnet_naming_rule.readonly_should_be_begins_with__.style = begins_with__
187
188dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
189dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
190dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
191
192dotnet_naming_rule.private_or_internal_field_should_be_camel_case.severity = error
193dotnet_naming_rule.private_or_internal_field_should_be_camel_case.symbols = private_or_internal_field
194dotnet_naming_rule.private_or_internal_field_should_be_camel_case.style = camel_case
195
196# Symbol specifications
197
198dotnet_naming_symbols.interface.applicable_kinds = interface
199dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
200dotnet_naming_symbols.interface.required_modifiers =
201
202dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
203dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
204dotnet_naming_symbols.private_or_internal_field.required_modifiers =
205
206dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
207dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
208dotnet_naming_symbols.types.required_modifiers =
209
210dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
211dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
212dotnet_naming_symbols.non_field_members.required_modifiers =
213
214dotnet_naming_symbols.constant.applicable_kinds = field
215dotnet_naming_symbols.constant.applicable_accessibilities = public, internal, private
216dotnet_naming_symbols.constant.required_modifiers = const
217
218dotnet_naming_symbols.readonly.applicable_kinds = field
219dotnet_naming_symbols.readonly.applicable_accessibilities = public, private
220dotnet_naming_symbols.readonly.required_modifiers = readonly
221
222# Naming styles
223
224dotnet_naming_style.pascal_case.required_prefix =
225dotnet_naming_style.pascal_case.required_suffix =
226dotnet_naming_style.pascal_case.word_separator =
227dotnet_naming_style.pascal_case.capitalization = pascal_case
228
229dotnet_naming_style.begins_with_i.required_prefix = I
230dotnet_naming_style.begins_with_i.required_suffix =
231dotnet_naming_style.begins_with_i.word_separator =
232dotnet_naming_style.begins_with_i.capitalization = pascal_case
233
234dotnet_naming_style.camel_case.required_prefix =
235dotnet_naming_style.camel_case.required_suffix =
236dotnet_naming_style.camel_case.word_separator =
237dotnet_naming_style.camel_case.capitalization = camel_case
238
239dotnet_naming_style.capitalized_snake_case.required_prefix =
240dotnet_naming_style.capitalized_snake_case.required_suffix =
241dotnet_naming_style.capitalized_snake_case.word_separator = _
242dotnet_naming_style.capitalized_snake_case.capitalization = all_upper
243
244dotnet_naming_style.begins_with__.required_prefix = _
245dotnet_naming_style.begins_with__.required_suffix =
246dotnet_naming_style.begins_with__.word_separator =
247dotnet_naming_style.begins_with__.capitalization = camel_case
248
249[*.{cs,vb}]
250dotnet_style_operator_placement_when_wrapping = beginning_of_line
251tab_width = 4
252indent_size = 4
253dotnet_style_coalesce_expression = true:suggestion
254dotnet_style_null_propagation = true:suggestion
255dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
256dotnet_style_prefer_auto_properties = true:silent
257dotnet_style_object_initializer = true:suggestion
258dotnet_style_collection_initializer = true:suggestion
259dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
260dotnet_style_prefer_conditional_expression_over_assignment = true:silent