Skip to content

Commit 0f8a4d6

Browse files
committed
Upgrade severity of warnings (and some suggestions) to errors
1 parent aa1c253 commit 0f8a4d6

File tree

4 files changed

+65
-67
lines changed

4 files changed

+65
-67
lines changed

.editorconfig

+60-60
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,26 @@ dotnet_diagnostic.CA2016.severity = error
5656
# CS0618: A class member was marked with the Obsolete attribute
5757
dotnet_diagnostic.CS0618.severity = suggestion
5858
# CS0649: Uninitialized private or internal field declaration that is never assigned a value
59-
dotnet_diagnostic.CS0649.severity = warning
59+
dotnet_diagnostic.CS0649.severity = error
6060
# CS1998: This async method lacks 'await' operators and will run synchronously
6161
dotnet_diagnostic.CS1998.severity = suggestion
6262
# CS4014: Consider applying the await operator to the result of the call
6363
dotnet_diagnostic.CS4014.severity = suggestion
6464

6565
# RCS1102: Make class static
66-
dotnet_diagnostic.RCS1102.severity = warning
66+
dotnet_diagnostic.RCS1102.severity = error
6767
# RCS1139: Add summary element to documentation comment
6868
dotnet_diagnostic.RCS1139.severity = silent
6969
# RCS1194: Implement exception constructors
7070
dotnet_diagnostic.RCS1194.severity = suggestion
7171
# RCS1210: Return completed task instead of returning null
72-
dotnet_diagnostic.RCS1210.severity = suggestion
72+
dotnet_diagnostic.RCS1210.severity = error
7373
# RCS1036: Remove unnecessary blank line
74-
dotnet_diagnostic.RCS1036.severity = warning
74+
dotnet_diagnostic.RCS1036.severity = error
7575
# RCS1075: Avoid empty catch clause that catches System.Exception
7676
dotnet_diagnostic.RCS1075.severity = suggestion
7777
# RCS1170: Use read-only auto-implemented property
78-
dotnet_diagnostic.RCS1170.severity = warning
78+
dotnet_diagnostic.RCS1170.severity = error
7979

8080
# VSTHRD002: Avoid problematic synchronous waits
8181
dotnet_diagnostic.VSTHRD002.severity = suggestion
@@ -90,123 +90,123 @@ dotnet_diagnostic.VSTHRD103.severity = suggestion
9090
# VSTHRD110: Observe result of async calls
9191
dotnet_diagnostic.VSTHRD110.severity = suggestion
9292
# VSTHRD114: Avoid returning a null Task
93-
dotnet_diagnostic.VSTHRD114.severity = suggestion
93+
dotnet_diagnostic.VSTHRD114.severity = error
9494
# VSTHRD200: Use "Async" suffix for awaitable methods
9595
dotnet_diagnostic.VSTHRD200.severity = silent
9696

9797
# xUnit2013: Do not use equality check to check for collection size
98-
dotnet_diagnostic.xUnit2013.severity = warning
98+
dotnet_diagnostic.xUnit2013.severity = error
9999
# xUnit1004: Test methods should not be skipped
100100
dotnet_diagnostic.xUnit1004.severity = suggestion
101101

102102
# IDE0001: Simplify name
103-
dotnet_diagnostic.IDE0001.severity = warning
103+
dotnet_diagnostic.IDE0001.severity = error
104104
# IDE0002: Simplify member access
105-
dotnet_diagnostic.IDE0001.severity = warning
105+
dotnet_diagnostic.IDE0001.severity = error
106106
# IDE0003: Remove this or Me qualification
107-
dotnet_diagnostic.IDE0003.severity = warning
107+
dotnet_diagnostic.IDE0003.severity = error
108108
# IDE0004: Remove unnecessary cast
109-
dotnet_diagnostic.IDE0004.severity = warning
109+
dotnet_diagnostic.IDE0004.severity = error
110110
# IDE0005: Remove unnecessary import
111-
dotnet_diagnostic.IDE0005.severity = suggestion
111+
dotnet_diagnostic.IDE0005.severity = error
112112
# IDE0008: Use explicit type instead of var
113-
dotnet_diagnostic.IDE0008.severity = warning
113+
dotnet_diagnostic.IDE0008.severity = error
114114
# IDE0011: Add braces
115-
dotnet_diagnostic.IDE0011.severity = warning
115+
dotnet_diagnostic.IDE0011.severity = error
116116
# IDE0016: Use throw expression
117-
dotnet_diagnostic.IDE0016.severity = warning
117+
dotnet_diagnostic.IDE0016.severity = error
118118
# IDE0017: Use object initializers
119-
dotnet_diagnostic.IDE0017.severity = warning
119+
dotnet_diagnostic.IDE0017.severity = error
120120
# IDE0018: Inline variable declaration
121-
dotnet_diagnostic.IDE0018.severity = warning
121+
dotnet_diagnostic.IDE0018.severity = error
122122
# IDE0019: Use pattern matching to avoid 'as' followed by a 'null' check
123-
dotnet_diagnostic.IDE0019.severity = warning
123+
dotnet_diagnostic.IDE0019.severity = error
124124
# IDE0020: Use pattern matching to avoid 'is' check followed by a cast (with variable)
125-
dotnet_diagnostic.IDE0020.severity = warning
125+
dotnet_diagnostic.IDE0020.severity = error
126126
# IDE0021: Use expression body for constructors
127-
dotnet_diagnostic.IDE0021.severity = warning
127+
dotnet_diagnostic.IDE0021.severity = error
128128
# IDE0022: Use expression body for methods
129-
dotnet_diagnostic.IDE0022.severity = warning
129+
dotnet_diagnostic.IDE0022.severity = error
130130
# IDE0023: Use expression body for conversion operators
131-
dotnet_diagnostic.IDE0023.severity = warning
131+
dotnet_diagnostic.IDE0023.severity = error
132132
# IDE0024: Use expression body for operators
133-
dotnet_diagnostic.IDE0024.severity = warning
133+
dotnet_diagnostic.IDE0024.severity = error
134134
# IDE0025: Use expression body for properties
135-
dotnet_diagnostic.IDE0025.severity = warning
135+
dotnet_diagnostic.IDE0025.severity = error
136136
# IDE0026: Use expression body for indexers
137-
dotnet_diagnostic.IDE0026.severity = warning
137+
dotnet_diagnostic.IDE0026.severity = error
138138
# IDE0027: Use expression body for accessors
139-
dotnet_diagnostic.IDE0027.severity = warning
139+
dotnet_diagnostic.IDE0027.severity = error
140140
# IDE0028: Use collection initializers
141-
dotnet_diagnostic.IDE0028.severity = warning
141+
dotnet_diagnostic.IDE0028.severity = error
142142
# IDE0029: Use coalesce expression (non-nullable types)
143-
dotnet_diagnostic.IDE0029.severity = warning
143+
dotnet_diagnostic.IDE0029.severity = error
144144
# IDE0030: Use coalesce expression (nullable types)
145-
dotnet_diagnostic.IDE0030.severity = warning
145+
dotnet_diagnostic.IDE0030.severity = error
146146
# IDE0031: Use null propagation
147-
dotnet_diagnostic.IDE0031.severity = warning
147+
dotnet_diagnostic.IDE0031.severity = error
148148
# IDE0032: Use auto property
149-
dotnet_diagnostic.IDE0032.severity = warning
149+
dotnet_diagnostic.IDE0032.severity = error
150150
# IDE0033: Use explicitly provided tuple name
151-
dotnet_diagnostic.IDE0033.severity = warning
151+
dotnet_diagnostic.IDE0033.severity = error
152152
# IDE0034: Simplify 'default' expression
153-
dotnet_diagnostic.IDE0034.severity = warning
153+
dotnet_diagnostic.IDE0034.severity = error
154154
# IDE0035: Remove unreachable code
155-
dotnet_diagnostic.IDE0035.severity = warning
155+
dotnet_diagnostic.IDE0035.severity = error
156156
# IDE0036: Order modifiers
157-
dotnet_diagnostic.IDE0036.severity = warning
157+
dotnet_diagnostic.IDE0036.severity = error
158158
# IDE0037: Use inferred member name
159-
dotnet_diagnostic.IDE0037.severity = warning
159+
dotnet_diagnostic.IDE0037.severity = error
160160
# IDE0038: Use pattern matching to avoid is check followed by a cast (without variable)
161-
dotnet_diagnostic.IDE0038.severity = suggestion
161+
dotnet_diagnostic.IDE0038.severity = error
162162
# IDE0040: Add accessibility modifiers
163-
dotnet_diagnostic.IDE0040.severity = warning
163+
dotnet_diagnostic.IDE0040.severity = error
164164
# IDE0041: Use is null check
165-
dotnet_diagnostic.IDE0041.severity = warning
165+
dotnet_diagnostic.IDE0041.severity = error
166166
# IDE0042: Deconstruct variable declaration
167-
dotnet_diagnostic.IDE0042.severity = warning
167+
dotnet_diagnostic.IDE0042.severity = error
168168
# IDE0044: Add readonly modifier
169-
dotnet_diagnostic.IDE0044.severity = warning
169+
dotnet_diagnostic.IDE0044.severity = error
170170
# IDE0045: Use conditional expression for assignment
171-
dotnet_diagnostic.IDE0045.severity = warning
171+
dotnet_diagnostic.IDE0045.severity = error
172172
# IDE0046: Use conditional expression for return
173173
dotnet_diagnostic.IDE0046.severity = silent
174174
# IDE0047: Remove unnecessary parentheses
175-
dotnet_diagnostic.IDE0047.severity = warning
175+
dotnet_diagnostic.IDE0047.severity = error
176176
# IDE0049: Use language keywords instead of framework type names for type references
177-
dotnet_diagnostic.IDE0049.severity = warning
177+
dotnet_diagnostic.IDE0049.severity = error
178178
# IDE0051: Remove unused private member
179-
dotnet_diagnostic.IDE0051.severity = warning
179+
dotnet_diagnostic.IDE0051.severity = error
180180
# IDE0052: Remove unread private member
181-
dotnet_diagnostic.IDE0052.severity = suggestion
181+
dotnet_diagnostic.IDE0052.severity = error
182182
# IDE0053: Use expression body for lambdas
183-
dotnet_diagnostic.IDE0053.severity = warning
183+
dotnet_diagnostic.IDE0053.severity = error
184184
# IDE0054: Use compound assignment
185-
dotnet_diagnostic.IDE0054.severity = warning
185+
dotnet_diagnostic.IDE0054.severity = error
186186
# IDE0063: Use simple 'using' statement
187-
dotnet_diagnostic.IDE0063.severity = warning
187+
dotnet_diagnostic.IDE0063.severity = error
188188
# IDE0066: Use switch expression
189-
dotnet_diagnostic.IDE0066.severity = warning
189+
dotnet_diagnostic.IDE0066.severity = error
190190
# IDE0071: Simplify interpolation
191-
dotnet_diagnostic.IDE0071.severity = warning
191+
dotnet_diagnostic.IDE0071.severity = error
192192
# IDE0073: Require file header
193-
dotnet_diagnostic.IDE0073.severity = warning
193+
dotnet_diagnostic.IDE0073.severity = error
194194
# IDE0075: Simplify conditional expression
195-
dotnet_diagnostic.IDE0075.severity = warning
195+
dotnet_diagnostic.IDE0075.severity = error
196196
# IDE0078: Use pattern matching
197-
dotnet_diagnostic.IDE0078.severity = warning
197+
dotnet_diagnostic.IDE0078.severity = error
198198
# IDE0082: Convert typeof to nameof
199-
dotnet_diagnostic.IDE0082.severity = warning
199+
dotnet_diagnostic.IDE0082.severity = error
200200
# IDE0083: Use pattern matching (not operator)
201-
dotnet_diagnostic.IDE0083.severity = warning
201+
dotnet_diagnostic.IDE0083.severity = error
202202
# IDE0090: Simplify new expression
203-
dotnet_diagnostic.IDE0090.severity = warning
203+
dotnet_diagnostic.IDE0090.severity = error
204204
# IDE0100: Remove unnecessary equality operator
205-
dotnet_diagnostic.IDE0100.severity = warning
205+
dotnet_diagnostic.IDE0100.severity = error
206206
# IDE0110: Remove unnecessary discard
207-
dotnet_diagnostic.IDE0110.severity = warning
207+
dotnet_diagnostic.IDE0110.severity = error
208208
# IDE1005: Use conditional delegate call
209-
dotnet_diagnostic.IDE1005.severity = warning
209+
dotnet_diagnostic.IDE1005.severity = error
210210

211211
[*.{json}]
212212
indent_size = 2

src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public StartEditorServicesCommand()
191191
[Parameter]
192192
public string StartupBanner { get; set; }
193193

194+
#pragma warning disable IDE0022
194195
protected override void BeginProcessing()
195196
{
196197
#if DEBUG
@@ -203,10 +204,10 @@ protected override void BeginProcessing()
203204
}
204205
}
205206
#endif
206-
207207
// Set up logging now for use throughout startup
208208
StartLogging();
209209
}
210+
#pragma warning restore IDE0022
210211

211212
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Uses ThrowTerminatingError() instead")]
212213
protected override void EndProcessing()

src/PowerShellEditorServices.Hosting/Internal/NamedPipeUtils.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
using System.Collections.Generic;
55
using System.IO;
66
using System.IO.Pipes;
7-
using System.Runtime.InteropServices;
87

98
#if !CoreCLR
109
using System.Security.Principal;
1110
using System.Security.AccessControl;
11+
#else
12+
using System.Runtime.InteropServices;
1213
#endif
1314

1415
namespace Microsoft.PowerShell.EditorServices.Hosting

src/PowerShellEditorServices/Services/Workspace/Handlers/ConfigurationHandler.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ internal class PsesConfigurationHandler : DidChangeConfigurationHandlerBase
3030
private readonly PsesInternalHost _psesHost;
3131
private readonly ILanguageServerFacade _languageServer;
3232
private bool _profilesLoaded;
33-
private readonly bool _extensionServiceInitialized;
3433
private bool _cwdSet;
3534

3635
public PsesConfigurationHandler(
@@ -127,10 +126,7 @@ await _psesHost.SetInitialWorkingDirectoryAsync(
127126
_cwdSet = true;
128127
}
129128

130-
if (!_extensionServiceInitialized)
131-
{
132-
await _extensionService.InitializeAsync().ConfigureAwait(false);
133-
}
129+
await _extensionService.InitializeAsync().ConfigureAwait(false);
134130

135131
// Run any events subscribed to configuration updates
136132
_logger.LogTrace("Running configuration update event handlers");

0 commit comments

Comments
 (0)