Skip to content

Commit a343223

Browse files
committed
Move to AnalysisLevel and update standard editorconfigs
1 parent b70f54e commit a343223

File tree

6 files changed

+100
-14
lines changed

6 files changed

+100
-14
lines changed

.editorconfig

Lines changed: 92 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trim_trailing_whitespace = true
99
indent_style = space
1010
indent_size = 4
1111

12-
[*.{sln,*proj}]
12+
[*.{sln,*proj,dotsettings}]
1313
charset = utf-8-bom
1414

1515
[*.md]
@@ -27,6 +27,9 @@ dotnet_style_explicit_tuple_names = true:error
2727
dotnet_style_predefined_type_for_locals_parameters_members = true:error
2828
dotnet_style_predefined_type_for_member_access = true:error
2929
dotnet_style_readonly_field = true:error
30+
csharp_style_var_elsewhere = true:silent
31+
csharp_style_var_for_built_in_types = true:silent
32+
csharp_style_var_when_type_is_apparent = true:silent
3033

3134
# Override ReSharper defaults
3235
csharp_space_after_cast = false
@@ -48,32 +51,115 @@ dotnet_naming_rule.interfaces.style = interfaces
4851
dotnet_naming_style.pascal_case.capitalization = pascal_case
4952

5053
dotnet_naming_symbols.namespaces_types_and_non_field_members.applicable_kinds = namespace, class, struct, enum, interface, delegate, type_parameter, method, property, event
51-
dotnet_naming_rule.namespaces_types_and_non_field_members.severity = error
54+
dotnet_naming_rule.namespaces_types_and_non_field_members.severity = warning
5255
dotnet_naming_rule.namespaces_types_and_non_field_members.symbols = namespaces_types_and_non_field_members
5356
dotnet_naming_rule.namespaces_types_and_non_field_members.style = pascal_case
5457

5558
dotnet_naming_symbols.non_private_fields.applicable_kinds = field
5659
dotnet_naming_symbols.non_private_fields.applicable_accessibilities = public, protected, protected_internal, internal
57-
dotnet_naming_rule.non_private_fields.severity = error
60+
dotnet_naming_rule.non_private_fields.severity = warning
5861
dotnet_naming_rule.non_private_fields.symbols = non_private_fields
5962
dotnet_naming_rule.non_private_fields.style = pascal_case
6063

6164
dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
6265
dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly
63-
dotnet_naming_rule.static_readonly_fields.severity = error
66+
dotnet_naming_rule.static_readonly_fields.severity = warning
6467
dotnet_naming_rule.static_readonly_fields.symbols = static_readonly_fields
6568
dotnet_naming_rule.static_readonly_fields.style = pascal_case
6669

6770
dotnet_naming_symbols.constant_fields.applicable_kinds = field
6871
dotnet_naming_symbols.constant_fields.required_modifiers = const
69-
dotnet_naming_rule.constant_fields.severity = error
72+
dotnet_naming_rule.constant_fields.severity = warning
7073
dotnet_naming_rule.constant_fields.symbols = constant_fields
7174
dotnet_naming_rule.constant_fields.style = pascal_case
7275

7376

7477
dotnet_naming_style.camel_case.capitalization = camel_case
7578

7679
dotnet_naming_symbols.other_fields_parameters_and_locals.applicable_kinds = field, parameter, local
77-
dotnet_naming_rule.other_fields_parameters_and_locals.severity = error
80+
dotnet_naming_rule.other_fields_parameters_and_locals.severity = warning
7881
dotnet_naming_rule.other_fields_parameters_and_locals.symbols = other_fields_parameters_and_locals
7982
dotnet_naming_rule.other_fields_parameters_and_locals.style = camel_case
83+
84+
85+
# .NET diagnostic configuration
86+
87+
# CS8509: The switch expression does not handle all possible inputs (it is not exhaustive).
88+
dotnet_diagnostic.CS8509.severity = silent
89+
# CS8524: The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value.
90+
dotnet_diagnostic.CS8524.severity = silent
91+
92+
# IDE0005: Using directive is unnecessary.
93+
dotnet_diagnostic.IDE0005.severity = warning
94+
95+
# CA1304: Specify CultureInfo
96+
dotnet_diagnostic.CA1304.severity = warning
97+
98+
# CA1305: Specify IFormatProvider
99+
dotnet_diagnostic.CA1305.severity = warning
100+
101+
# CA1310: Specify StringComparison for correctness
102+
dotnet_diagnostic.CA1310.severity = warning
103+
104+
# CA1825: Avoid zero-length array allocations
105+
dotnet_diagnostic.CA1825.severity = warning
106+
107+
# CA2016: Forward the 'CancellationToken' parameter to methods that take one
108+
dotnet_diagnostic.CA2016.severity = warning
109+
110+
# CA2208: Instantiate argument exceptions correctly
111+
dotnet_diagnostic.CA2208.severity = warning
112+
113+
# CA2211: Non-constant fields should not be visible
114+
dotnet_diagnostic.CA2211.severity = warning
115+
116+
# CA2219: Do not raise exceptions in finally clauses
117+
dotnet_diagnostic.CA2219.severity = warning
118+
119+
# CA2231: Overload operator equals on overriding value type Equals
120+
dotnet_diagnostic.CA2231.severity = warning
121+
122+
# CA1806: Do not ignore method results
123+
dotnet_diagnostic.CA1806.severity = silent
124+
125+
# CA1816: Dispose methods should call SuppressFinalize
126+
dotnet_diagnostic.CA1816.severity = none
127+
128+
# CA1822: Mark members as static
129+
dotnet_diagnostic.CA1822.severity = silent
130+
131+
# CA1826: Do not use Enumerable methods on indexable collections
132+
dotnet_diagnostic.CA1826.severity = silent
133+
134+
# CA1834: Consider using 'StringBuilder.Append(char)' when applicable
135+
dotnet_diagnostic.CA1834.severity = silent
136+
137+
# CA1806: Do not ignore method results
138+
dotnet_diagnostic.CA1806.severity = silent
139+
140+
# CA2245: Do not assign a property to itself
141+
dotnet_diagnostic.CA2245.severity = silent
142+
143+
# CA2201: Do not raise reserved exception types
144+
dotnet_diagnostic.CA2201.severity = warning
145+
146+
# CA1805: Do not initialize unnecessarily
147+
dotnet_diagnostic.CA1805.severity = warning
148+
149+
# CA1725: Parameter names should match base declaration
150+
dotnet_diagnostic.CA1725.severity = warning
151+
152+
# IDE0001: Simplify Names
153+
dotnet_diagnostic.IDE0001.severity = warning
154+
155+
# CA2215: Dispose methods should call base class dispose
156+
dotnet_diagnostic.CA2215.severity = warning
157+
158+
# IDE0059: Unnecessary assignment of a value
159+
dotnet_diagnostic.IDE0059.severity = warning
160+
161+
# CA1031: Do not catch general exception types
162+
dotnet_diagnostic.CA1031.severity = warning
163+
164+
# CA1303: Do not pass literals as localized parameters
165+
dotnet_diagnostic.CA1303.severity = none
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[*]
2+
3+
# CA1031: Do not catch general exception types
4+
dotnet_diagnostic.CA1031.severity = none
5+
6+
# CA2201: Do not raise reserved exception types
7+
dotnet_diagnostic.CA2201.severity = none

src/AmbientTasks.Tests/GlobalSuppressions.cs

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/AmbientTasks/AmbientTasks.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public static void Add(Task? task)
8080
}
8181
}
8282

83-
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "All exceptions are caught and passed to the appropriate handler by design.")]
8483
private static void OnTaskCompleted(Task completedTask, object? state)
8584
{
8685
var (context, addSynchronizationContext, taskWasStarted) = ((AmbientTaskContext, SynchronizationContext, bool))state!;

src/AmbientTasks/GlobalSuppressions.cs

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<LangVersion>latest</LangVersion>
55
<Nullable>enable</Nullable>
6-
<Features>strict</Features>
6+
<AnalysisLevel>latest</AnalysisLevel>
77
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
88
</PropertyGroup>
99

0 commit comments

Comments
 (0)