-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path.editorconfig
More file actions
65 lines (51 loc) · 2.55 KB
/
Copy path.editorconfig
File metadata and controls
65 lines (51 loc) · 2.55 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
root = true
[*]
indent_style = space
charset = utf-8
end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = true
[*.cs]
indent_size = 4
[*.{csproj,props,targets,xml,resx}]
indent_size = 2
[*.{md,yml,yaml,json}]
indent_size = 2
# C# code style - aligned with the existing conventions of the project.
[*.cs]
# Project convention: using directives go INSIDE the namespace block.
csharp_using_directive_placement = inside_namespace:warning
# Allman braces (already the case everywhere in the codebase).
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
# Block-scoped namespaces (file-scoped is C# 10 but the project uses block-scoped).
csharp_style_namespace_declarations = block_scoped:silent
# Encourage modern syntax now that LangVersion is bumped to C# 10.
# Suggestion-level only - existing code is not flagged as errors.
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
# CA2263: prefers the generic Enum.GetValues<TEnum>() overload, which only exists on
# .NET 5+. The shared source is also compiled into the .NET Framework 4.8 projects
# (InfoBox, InfoBox.Designer), where only the non-generic Enum.GetValues(Type) exists -
# so the suggested fix cannot be applied without breaking the dual-build. Suppressed.
dotnet_diagnostic.CA2263.severity = none
# CA1863: suggests caching a System.Text.CompositeFormat for reused format strings.
# CompositeFormat only exists on .NET 8+, but the shared source also compiles on
# .NET Framework 4.8 - the suggested fix is unavailable there, same dual-build
# constraint as CA2263. Suppressed.
dotnet_diagnostic.CA1863.severity = none
# Test files: relax rules that conflict with established test-writing idioms.
[**/*Tests.cs]
# CA1707: Underscores in test method names (e.g. Method_WithCondition_ReturnsExpected)
# are the convention across the project's existing tests; the readability is the point.
dotnet_diagnostic.CA1707.severity = none
# CA1861: Inline constant arrays in test arrange-act blocks are clearer than extracted
# static readonly fields and the perf gain is irrelevant in a test context.
dotnet_diagnostic.CA1861.severity = none