-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.editorconfig
More file actions
157 lines (132 loc) · 6.41 KB
/
.editorconfig
File metadata and controls
157 lines (132 loc) · 6.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Top-most EditorConfig file
root = true
# General text settings
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
# C# files
[*.cs]
# Language version (Rider/VS honor project settings first; this is a hint)
dotnet_language_version = latest
# Organize usings
dotnet_sort_system_directives_first = true
csharp_using_directive_placement = inside_namespace:suggestion
# Namespaces
csharp_style_namespace_declarations = file_scoped:suggestion
# Prefer modern features
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_prefer_collection_expression = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_prefer_raw_string_literals = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
csharp_style_prefer_readonly_fields = true:suggestion
csharp_style_prefer_static_local_function = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_method_group_conversion = true:suggestion
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
# 'var' preferences — keep explicit when apparent, use var elsewhere
# - Built-in types (int, string, etc.) -> keep explicit
# - When type is apparent from RHS -> keep explicit
# - Elsewhere (not apparent/unknown) -> use var
# Keep explicit for built-in types
csharp_style_var_for_built_in_types = false:suggestion
# Keep explicit when type is apparent
csharp_style_var_when_type_is_apparent = false:suggestion
# Use var elsewhere (type not apparent)
csharp_style_var_elsewhere = true:suggestion
# Nullability and modern idioms
csharp_style_prefer_null_check_over_conditional_access = false:none
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_coalesce_expression = true:suggestion
csharp_style_prefer_null_propagation = true:suggestion
csharp_style_prefer_is_not_expression = true:suggestion
# Object/collection creation
csharp_style_object_initializer = true:suggestion
csharp_style_collection_initializer = true:suggestion
csharp_style_prefer_simple_default_expression = true:suggestion
csharp_style_prefer_target_typed_new = true:suggestion
csharp_style_prefer_simplified_boolean_expressions = true:suggestion
# Pattern matching preferences
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
# Using and qualification
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# Simplifications
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
csharp_style_prefer_simplified_interpolation = true:suggestion
csharp_style_prefer_default_literal = true:suggestion
csharp_style_prefer_inferred_tuple_names = true:suggestion
csharp_style_prefer_inferred_anonymous_type_member_names = true:suggestion
# 'this.' preferences
dotnet_style_qualification_for_property = false:suggestion
csharp_style_prefer_this_or_me = false:none
# New line and wrapping rules
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
csharp_prefer_braces = when_multiline:suggestion
# Spacing
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
# Parentheses
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
csharp_style_parentheses_in_relational_binary_operators = never_if_unnecessary
csharp_style_parentheses_in_other_binary_operators = never_if_unnecessary
csharp_style_parentheses_in_other_operators = never_if_unnecessary
# File header (optional)
# file_header_template = Licensed under the MIT license.
# Analyzers — general severity defaults
# Make security and reliability strict, keep style as suggestions to avoid noise.
dotnet_analyzer_diagnostic.category-Security.severity = error
dotnet_analyzer_diagnostic.category-Reliability.severity = warning
dotnet_analyzer_diagnostic.category-Performance.severity = warning
dotnet_analyzer_diagnostic.category-Style.severity = suggestion
dotnet_analyzer_diagnostic.category-Usage.severity = warning
# Commonly useful analyzer toggles
# Prefer readonly on fields where possible
dotnet_style_readonly_field = true:suggestion
# Prefer using 'nameof'
dotnet_style_prefer_nameof_expression = true:suggestion
# Prefer collection expressions where available (C# 12)
dotnet_style_prefer_collection_expression = true:suggestion
# Naming conventions
# Symbols
dotnet_naming_symbols_private_fields.applicable_kinds = field
dotnet_naming_symbols_private_fields.applicable_accessibilities = private
# Styles
dotnet_naming_style_underscore_prefix.capitalization = camel_case
dotnet_naming_style_underscore_prefix.required_prefix = _
# Rules — private fields use _camelCase
dotnet_naming_rule_private_fields_underscore_prefix.symbols = dotnet_naming_symbols_private_fields
dotnet_naming_rule_private_fields_underscore_prefix.style = dotnet_naming_style_underscore_prefix
dotnet_naming_rule_private_fields_underscore_prefix.severity = suggestion
# Files that are generated (keep them relaxed)
[*.designer.cs]
dotnet_analyzer_diagnostic.category-Style.severity = silent
[*.g.cs]
dotnet_analyzer_diagnostic.category-Style.severity = silent
[*.generated.cs]
dotnet_analyzer_diagnostic.category-Style.severity = silent