-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.editorconfig
More file actions
97 lines (83 loc) · 4.81 KB
/
Copy path.editorconfig
File metadata and controls
97 lines (83 loc) · 4.81 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
# .editorconfig — Asatryan.MonoSlice template
# Only entries that deviate from Roslyn SDK defaults. Restating defaults is intentionally avoided.
# Build-time enforcement requires <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>.
root = true
############################################################
# All files — EditorConfig spec keys (no SDK provides these)
############################################################
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
############################################################
# Project + config files (2-space convention)
############################################################
[*.{csproj,props,targets,slnx,resx,xml,config,nuspec,json,yml,yaml,md}]
indent_size = 2
[*.{cmd,bat}]
end_of_line = crlf
############################################################
# C# — surface style rules at build that ship below warning by default
############################################################
[*.cs]
dotnet_diagnostic.IDE0055.severity = warning # apply formatting (dotnet-format)
dotnet_diagnostic.IDE0011.severity = warning # add braces; csharp_prefer_braces is true by default but ships silent
# Bug detectors escalated to error — fail the build, not just nag
dotnet_diagnostic.CA1849.severity = error # call async methods in async context
dotnet_diagnostic.CA1853.severity = error # unnecessary ContainsKey before indexer
dotnet_diagnostic.CA1854.severity = error # prefer IDictionary.TryGetValue
dotnet_diagnostic.CA1862.severity = error # use StringComparison overloads (no ToLower/ToUpper for compare)
dotnet_diagnostic.CA2016.severity = error # forward CancellationToken to async calls
dotnet_diagnostic.CA2017.severity = error # logging template parameter count mismatch
dotnet_diagnostic.CA2023.severity = error # invalid braces in logging message template
dotnet_diagnostic.CA2200.severity = error # rethrow correctly to preserve stack trace
dotnet_diagnostic.CA2245.severity = error # do not assign property to itself
dotnet_diagnostic.CS0659.severity = error # override Equals without GetHashCode
dotnet_diagnostic.CS1717.severity = error # variable assigned to itself
dotnet_diagnostic.CS1718.severity = error # comparison made to same variable
# Non-default option values
csharp_style_namespace_declarations = file_scoped
csharp_using_directive_placement = outside_namespace
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
dotnet_style_namespace_match_folder = true
# ReSharper / Rider inspection suppressions
resharper_entity_framework_model_validation_unlimited_string_length_highlighting = none
# ReSharper / Rider — brace enforcement for Rider Code Cleanup (mirrors IDE0011 scope)
resharper_braces_for_ifelse = required
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_while = required
resharper_braces_for_dowhile = required
resharper_braces_for_using = required
resharper_braces_for_lock = required
resharper_braces_for_fixed = required
# ReSharper / Rider — attributes on their own line (Roslyn/dotnet format has no equivalent; Rider Reformat applies it)
resharper_csharp_place_attribute_on_same_line = never
# Naming. More-specific rules first (Roslyn matches the first applicable rule).
# Const fields: PascalCase regardless of accessibility (Framework Design Guidelines).
dotnet_naming_rule.const_fields_pascal.severity = warning
dotnet_naming_rule.const_fields_pascal.symbols = const_fields
dotnet_naming_rule.const_fields_pascal.style = pascal_case
dotnet_naming_symbols.const_fields.applicable_kinds = field
dotnet_naming_symbols.const_fields.applicable_accessibilities = *
dotnet_naming_symbols.const_fields.required_modifiers = const
# Static readonly fields: PascalCase (treated as compile-time-ish constants).
dotnet_naming_rule.static_readonly_pascal.severity = warning
dotnet_naming_rule.static_readonly_pascal.symbols = static_readonly_fields
dotnet_naming_rule.static_readonly_pascal.style = pascal_case
dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = *
dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly
# Mutable private/internal instance fields: _camelCase.
dotnet_naming_rule.private_fields_underscore.severity = warning
dotnet_naming_rule.private_fields_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_underscore.style = underscore_camel
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, internal
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.underscore_camel.required_prefix = _
dotnet_naming_style.underscore_camel.capitalization = camel_case