@@ -12,19 +12,107 @@ csharp_indent_switch_labels = true
12
12
csharp_indent_case_contents = true
13
13
csharp_indent_labels = one_less_than_current
14
14
15
- # Globalization rules
16
- dotnet_code_quality.CA1305.excluded_symbol_names = T:System.Byte|T:System.SByte|T:System.Int16|T:System.UInt16|T:System.Int32|T:System.UInt32|T:System.Int64|T:System.UInt64|T:System.String|T:System.Text.StringBuilder|T:System.Convert
15
+ # Style rules
16
+ # Can't be in .globalconfig because dotnet format doesn't respect that https://github.com/dotnet/format/issues/1643
17
17
18
- dotnet_diagnostic.CA1305.severity = error
19
- dotnet_diagnostic.CA2101.severity = suggestion
18
+ # Remove unnecessary cast
19
+ dotnet_diagnostic.IDE0004.severity = warning
20
+ # Remove unnecessary import
21
+ dotnet_diagnostic.IDE0005.severity = warning
22
+ # Use var instead of explicit type
23
+ dotnet_diagnostic.IDE0007.severity = suggestion
24
+ # Use explicit type instead of var
25
+ dotnet_diagnostic.IDE0008.severity = suggestion
26
+ # Inline variable declaration
27
+ dotnet_diagnostic.IDE0018.severity = warning
28
+ # Use pattern matching to avoid as followed by a null check
29
+ dotnet_diagnostic.IDE0019.severity = warning
30
+ # Use pattern matching to avoid is check followed by a cast (with variable)
31
+ dotnet_diagnostic.IDE0020.severity = warning
32
+ # Use expression body for methods
33
+ dotnet_diagnostic.IDE0022.severity = suggestion
34
+ # Use expression body for properties
35
+ dotnet_diagnostic.IDE0025.severity = suggestion
36
+ # Use expression body for indexers
37
+ dotnet_diagnostic.IDE0026.severity = suggestion
38
+ # Use expression body for accessors
39
+ dotnet_diagnostic.IDE0027.severity = suggestion
40
+ # Null check can be simplified
41
+ dotnet_diagnostic.IDE0029.severity = warning
42
+ # Null check can be simplified
43
+ dotnet_diagnostic.IDE0030.severity = warning
44
+ # Use null propagation
45
+ dotnet_diagnostic.IDE0031.severity = warning
46
+ # Use auto property
47
+ dotnet_diagnostic.IDE0032.severity = suggestion
48
+ # Simplify default expression
49
+ dotnet_diagnostic.IDE0034.severity = suggestion
50
+ # Use pattern matching to avoid is check followed by a cast (without variable)
51
+ dotnet_diagnostic.IDE0038.severity = warning
52
+ # Use is null check
53
+ dotnet_diagnostic.IDE0041.severity = warning
54
+ # Deconstruct variable declaration
55
+ dotnet_diagnostic.IDE0042.severity = suggestion
56
+ # dotnet_diagnostic.IDE0049.severity = error # see SA1121
57
+ # Remove unused private member
58
+ dotnet_diagnostic.IDE0051.severity = suggestion
59
+ # Remove unread private member
60
+ dotnet_diagnostic.IDE0052.severity = silent # TODO: should be warning imo, but there's too much violation currently
61
+ # Use compound assignment
62
+ dotnet_diagnostic.IDE0054.severity = warning
63
+ # Use index operator
64
+ dotnet_diagnostic.IDE0056.severity = warning
65
+ # Use range operator
66
+ dotnet_diagnostic.IDE0057.severity = warning
67
+ # Use simple using statement
68
+ dotnet_diagnostic.IDE0063.severity = suggestion
69
+ # Make struct fields writable
70
+ dotnet_diagnostic.IDE0064.severity = error
71
+ # using directive placement
72
+ dotnet_diagnostic.IDE0065.severity = error
73
+ # Use switch expression
74
+ dotnet_diagnostic.IDE0066.severity = suggestion
75
+ # Use System.HashCode.Combine
76
+ dotnet_diagnostic.IDE0070.severity = warning
77
+ # Simplify interpolation
78
+ dotnet_diagnostic.IDE0071.severity = suggestion
79
+ # Use coalesce compound assignment
80
+ dotnet_diagnostic.IDE0074.severity = suggestion
81
+ # Use pattern matching
82
+ dotnet_diagnostic.IDE0078.severity = suggestion
83
+ # Convert typeof to nameof
84
+ dotnet_diagnostic.IDE0082.severity = warning
85
+ # Use pattern matching (not operator)
86
+ dotnet_diagnostic.IDE0083.severity = warning
87
+ # Simplify new expression
88
+ dotnet_diagnostic.IDE0090.severity = suggestion
89
+ # Remove unnecessary equality operator
90
+ dotnet_diagnostic.IDE0100.severity = warning
91
+ # Remove unnecessary discard
92
+ dotnet_diagnostic.IDE0110.severity = warning
93
+ # Simplify LINQ expression
94
+ dotnet_diagnostic.IDE0120.severity = error
95
+ # Namespace does not match folder structure
96
+ dotnet_diagnostic.IDE0130.severity = silent # should be warning imo
97
+ # Use tuple to swap values
98
+ dotnet_diagnostic.IDE0180.severity = suggestion
99
+ # Use UTF-8 string literal
100
+ dotnet_diagnostic.IDE0230.severity = warning
101
+ # Nullable directive is redundant
102
+ dotnet_diagnostic.IDE0240.severity = warning
103
+ # Nullable directive is unnecessary
104
+ dotnet_diagnostic.IDE0241.severity = warning
105
+ # Struct can be made 'readonly'
106
+ dotnet_diagnostic.IDE0250.severity = suggestion
107
+ # Use pattern matching
108
+ dotnet_diagnostic.IDE0260.severity = suggestion
109
+ # Use nameof
110
+ dotnet_diagnostic.IDE0280.severity = error
20
111
21
- # Performance rules
22
- dotnet_code_quality.CA1826.exclude_ordefault_methods = true
112
+ csharp_style_var_when_type_is_apparent = true
113
+ csharp_style_var_elsewhere = true
23
114
24
- dotnet_diagnostic.CA1805.severity = silent
25
- dotnet_diagnostic.CA1822.severity = silent
26
- dotnet_diagnostic.CA1838.severity = suggestion
27
-
28
- # Usage rules
29
- dotnet_diagnostic.CA1816.severity = none
30
- dotnet_diagnostic.CA2201.severity = suggestion
115
+ csharp_style_expression_bodied_methods = when_on_single_line
116
+ csharp_style_expression_bodied_properties = when_on_single_line
117
+ csharp_style_expression_bodied_indexers = when_on_single_line
118
+ csharp_style_expression_bodied_accessors = when_on_single_line
0 commit comments