-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.editorconfig
More file actions
99 lines (87 loc) · 5.25 KB
/
.editorconfig
File metadata and controls
99 lines (87 loc) · 5.25 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
# EditorConfig for ErrorOrX
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.cs]
# ANcpLua.Analyzers rules
dotnet_diagnostic.AL0025.severity = warning # Prefer static lambda
dotnet_diagnostic.AL0026.severity = warning # DateTime.Now/UtcNow
dotnet_diagnostic.AL0027.severity = warning # Newtonsoft.Json
# CA1062: Validate arguments of public methods — Roslyn callbacks guarantee non-null
dotnet_diagnostic.CA1062.severity = none
# CA1308: Normalize strings to uppercase — lowercase is standard for URL routes
dotnet_diagnostic.CA1308.severity = none
# Meziantou — suppress opinionated style rules
dotnet_diagnostic.MA0002.severity = none # StringBuilder — generator code uses IndentedTextWriter
dotnet_diagnostic.MA0006.severity = none # string.Equals — string == is ordinal, explicit enough
dotnet_diagnostic.MA0008.severity = none # StructLayoutAttribute — unnecessary for managed types
dotnet_diagnostic.MA0011.severity = none # IFormatProvider on TryParse — netstandard2.0 is fine
dotnet_diagnostic.MA0048.severity = none # File name must match type — partial classes + DTOs are intentional
dotnet_diagnostic.MA0049.severity = none # Type name ≠ namespace — ErrorOr in ErrorOrX is by design
dotnet_diagnostic.MA0004.severity = none # ConfigureAwait — ASP.NET Core has no SynchronizationContext
dotnet_diagnostic.MA0016.severity = none # Collection abstraction — contradicts CA1859 (use concrete types)
dotnet_diagnostic.MA0051.severity = none # Method too long — source generators have legitimate long methods
# ============================================================================
# IDE Suggestion-Level Rules Rationale
# ============================================================================
# Pattern matching rules (IDE0019, IDE0020, IDE0078, IDE0083, IDE0170) are
# intentionally set to "suggestion" rather than "warning" because:
#
# 1. Source Generator Constraints: ErrorOrX.Generators targets netstandard2.0
# for Roslyn analyzer compatibility. Some pattern matching features have
# limited support or different behavior in older language versions.
#
# 2. Generated Code Stability: The generator emits code targeting multiple
# .NET versions. Using simpler constructs (explicit casts, null checks)
# ensures broader compatibility and predictable behavior.
#
# 3. Auto-fixable: These are style preferences, not correctness issues.
# Developers can apply fixes individually when appropriate.
#
# Do NOT escalate these to "warning" - the current severity is intentional.
# ============================================================================
# Pattern matching style rules (auto-fixable)
dotnet_diagnostic.IDE0019.severity = suggestion # Use pattern matching to avoid 'as' followed by null check
dotnet_diagnostic.IDE0020.severity = suggestion # Use pattern matching to avoid 'is' check followed by cast
dotnet_diagnostic.IDE0078.severity = suggestion # Use pattern matching
dotnet_diagnostic.IDE0083.severity = suggestion # Use pattern matching (not null)
dotnet_diagnostic.IDE0170.severity = suggestion # Simplify property pattern
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
# ============================================================================
# Test Project Suppressions
# ============================================================================
# Test code intentionally uses patterns that trigger warnings in production code.
# These are suppressed for test files only.
[tests/**/*.cs]
resharper_nullable_warning_suppression_is_used_highlighting = none
resharper_not_accessed_positional_property_local_highlighting = none
resharper_possible_multiple_enumeration_highlighting = none
resharper_return_value_of_pure_method_is_not_used_highlighting = none
resharper_redundant_nullable_warning_suppression_highlighting = none
[**/src/**/*.cs]
# CA1859 requires concrete types for private methods; ReSharper suggests the opposite
resharper_parameter_type_can_be_enumerable_local_highlighting = none
resharper_suggest_base_type_for_parameter_highlighting = none
# ============================================================================
# Generator-Specific Suppressions
# ============================================================================
# Polyfills.cs: Types MUST live in System.* namespaces for netstandard2.0
# compatibility (e.g., System.Runtime.CompilerServices.IsExternalInit).
# The namespace intentionally does not match the folder structure.
[**/ErrorOrX.Generators/Polyfills.cs]
dotnet_diagnostic.IDE0130.severity = none
dotnet_diagnostic.CA1019.severity = none # Polyfill attribute constructor — intentional design
dotnet_diagnostic.CA1305.severity = none # uint.ToString() — no locale dependence
dotnet_diagnostic.CA1812.severity = none # IsExternalInit — compiler-reserved type
# Extractor.cs: AL0029 flags foreach-over-GetAttributes() loops, suggesting
# HasAttribute() instead. These loops legitimately need to extract constructor
# arguments and named arguments from AttributeData, not just check existence.
[**/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.Extractor.cs]
dotnet_diagnostic.AL0029.severity = none