8000 Enable `SA1008` Opening parenthesis should be spaced correctly (#14242) · awakecoding/PowerShell@a562fa6 · GitHub
[go: up one dir, main page]

Skip to content

Commit a562fa6

Browse files
authored
Enable SA1008 Opening parenthesis should be spaced correctly (PowerShell#14242)
1 parent 1feed06 commit a562fa6

File tree

6 files changed

+32
-30
lines changed

6 files changed

+32
-30
lines changed

.globalconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ dotnet_diagnostic.SA1006.severity = warning
10381038
dotnet_diagnostic.SA1007.severity = warning
10391039

10401040
# SA1008: Opening parenthesis should be spaced correctly
1041-
dotnet_diagnostic.SA1008.severity = no 10000 ne
1041+
dotnet_diagnostic.SA1008.severity = warning
10421042

10431043
# SA1009: Closing parenthesis should be spaced correctly
10441044
dotnet_diagnostic.SA1009.severity = none

src/System.Management.Automation/engine/Modules/AnalysisCache.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal static class AnalysisCache
3333

3434
// This dictionary shouldn't see much use, so low concurrency and capacity
3535
private static readonly ConcurrentDictionary<string, string> s_modulesBeingAnalyzed =
36-
new ConcurrentDictionary<string, string>( /*concurrency*/1, /*capacity*/2, StringComparer.OrdinalIgnoreCase);
36+
new(concurrencyLevel: 1, capacity: 2, StringComparer.OrdinalIgnoreCase);
3737

3838
internal static readonly char[] InvalidCommandNameCharacters = new[]
3939
{
@@ -384,8 +384,10 @@ private static ConcurrentDictionary<string, CommandTypes> AnalyzeScriptModule(st
384384
}
385385
}
386386

387-
var exportedClasses = new ConcurrentDictionary<string, TypeAttributes>( /*concurrency*/
388-
1, scriptAnalysis.DiscoveredClasses.Count, StringComparer.OrdinalIgnoreCase);
387+
ConcurrentDictionary<string, TypeAttributes> exportedClasses = new(
388+
concurrencyLevel: 1,
389+
capacity: scriptAnalysis.DiscoveredClasses.Count,
390+
StringComparer.OrdinalIgnoreCase);
389391
foreach (var exportedClass in scriptAnalysis.DiscoveredClasses)
390392
{
391393
exportedClasses[exportedClass.Name] = exportedClass.TypeAttributes;

src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace System.Management.Automation.Remoting
3333
/// <param name="extraInfo">PCWSTR.</param>
3434
/// <param name="startupInfo">WSMAN_SHELL_STARTUP_INFO*.</param>
3535
/// <param name="inboundShellInformation">WSMAN_DATA*.</param>
36-
internal delegate void WSMPluginShellDelegate( // TODO: Rename to WSManPluginShellDelegate once I remove the MC++ module.
36+
internal delegate void WSManPluginShellDelegate(
3737
IntPtr pluginContext,
3838
IntPtr requestDetails,
3939
int flags,
@@ -45,7 +45,7 @@ internal delegate void WSMPluginShellDelegate( // TODO: Rename to WSManPluginShe
4545
/// </summary>
4646
/// <param name="pluginContext">PVOID.</param>
4747
/// <param name="shellContext">PVOID.</param>
48-
internal delegate void WSMPluginReleaseShellContextDelegate(
48+
internal delegate void WSManPluginReleaseShellContextDelegate(
4949
IntPtr pluginContext,
5050
IntPtr shellContext);
5151

@@ -57,7 +57,7 @@ internal delegate void WSMPluginReleaseShellContextDelegate(
5757
/// <param name="shellContext">PVOID.</param>
5858
/// <param name="commandContext">PVOID optional.</param>
5959
/// <param name="inboundConnectInformation">WSMAN_DATA* optional.</param>
60-
internal delegate void WSMPluginConnectDelegate(
60+
internal delegate void WSManPluginConnectDelegate(
6161
IntPtr pluginContext,
6262
IntPtr requestDetails,
6363
int flags,
@@ -73,7 +73,7 @@ internal delegate void WSMPluginConnectDelegate(
7373
/// <param name="shellContext">PVOID.</param>
7474
/// <param name="commandLine">PCWSTR.</param>
7575
/// <param name="arguments">WSMAN_COMMAND_ARG_SET*.</param>
76-
internal delegate void WSMPluginCommandDelegate(
76+
internal delegate void WSManPluginCommandDelegate(
7777
IntPtr pluginContext,
7878
IntPtr requestDetails,
7979
int flags,
@@ -85,15 +85,15 @@ internal delegate void WSMPluginCommandDelegate(
8585
/// Delegate that is passed to native layer for callback on operation shutdown notifications.
8686
/// </summary>
8787
/// <param name="shutdownContext">IntPtr.</param>
88-
internal delegate void WSMPluginOperationShutdownDelegate(
88+
internal delegate void WSManPluginOperationShutdownDelegate(
8989
IntPtr shutdownContext);
9090

9191
/// <summary>
9292
/// </summary>
9393
/// <param name="pluginContext">PVOID.</param>
9494
/// <param name="shellContext">PVOID.</param>
9595
/// <param name="commandContext">PVOID.</param>
96-
internal delegate void WSMPluginReleaseCommandContextDelegate(
96+
internal delegate void WSManPluginReleaseCommandContextDelegate(
9797
IntPtr pluginContext,
9898
IntPtr shellContext,
9999
IntPtr commandContext);
@@ -107,7 +107,7 @@ internal delegate void WSMPluginReleaseCommandContextDelegate(
107107
/// <param name="commandContext">PVOID.</param>
108108
/// <param name="stream">PCWSTR.</param>
109109
/// <param name="inboundData">WSMAN_DATA*.</param>
110-
internal delegate void WSMPluginSendDelegate(
110+
internal delegate void WSManPluginSendDelegate(
111111
IntPtr pluginContext,
112112
IntPtr requestDetails,
113113
int flags,
@@ -124,7 +124,7 @@ internal delegate void WSMPluginSendDelegate(
124124
/// <param name="shellContext">PVOID.</param>
125125
/// <param name="commandContext">PVOID optional.</param>
126126
/// <param name="streamSet">WSMAN_STREAM_ID_SET* optional.</param>
127-
internal delegate void WSMPluginReceiveDelegate(
127+
internal delegate void WSManPluginReceiveDelegate(
128128
IntPtr pluginContext,
129129
IntPtr requestDetails,
130130
int flags,
@@ -140,7 +140,7 @@ internal delegate void WSMPluginReceiveDelegate(
140140
/// <param name="shellContext">PVOID.</param>
141141
/// <param name="commandContext">PVOID optional.</param>
142142
/// <param name="code">PCWSTR.</param>
143-
internal delegate void WSMPluginSignalDelegate(
143+
internal delegate void WSManPluginSignalDelegate(
144144
IntPtr pluginContext,
145145
IntPtr requestDetails,
146146
int flags,
@@ -160,7 +160,7 @@ internal delegate void WaitOrTimerCallbackDelegate(
160160
/// <summary>
161161
/// </summary>
162162
/// <param name="pluginContext">PVOID.</param>
163-
internal delegate void WSMShutdownPluginDelegate(
163+
internal delegate void WSManShutdownPluginDelegate(
164164
IntPtr pluginContext);
165165

166166
/// <summary>
@@ -192,7 +192,7 @@ internal WSManPluginEntryDelegatesInternal UnmanagedStruct
192192
private GCHandle _pluginSignalGCHandle;
193193
private GCHandle _pluginConnectGCHandle;
194194
private GCHandle _shutdownPluginGCHandle;
195-
private GCHandle _WSMPluginOperationShutdownGCHandle;
195+
private GCHandle _WSManPluginOperationShutdownGCHandle;
196196

197197
#endregion
198198

@@ -255,57 +255,57 @@ private void populateDelegates()
255255
// disposal. Using GCHandle without pinning reduces fragmentation potential
256256
// of the managed heap.
257257
{
258-
WSMPluginShellDelegate pluginShell = new WSMPluginShellDelegate(WSManPluginManagedEntryWrapper.WSManPluginShell);
258+
WSManPluginShellDelegate pluginShell = new WSManPluginShellDelegate(WSManPluginManagedEntryWrapper.WSManPluginShell);
259259
_pluginShellGCHandle = GCHandle.Alloc(pluginShell);
260260
// marshal the delegate to a unmanaged function pointer so that AppDomain reference is stored correctly.
261261
// Populate the outgoing structure so the caller has access to the entry points
262262
_unmanagedStruct.wsManPluginShellCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginShell);
263263
}
264264
{
265-
WSMPluginReleaseShellContextDelegate pluginReleaseShellContext = new WSMPluginReleaseShellContextDelegate(WSManPluginManagedEntryWrapper.WSManPluginReleaseShellContext);
265+
WSManPluginReleaseShellContextDelegate pluginReleaseShellContext = new WSManPluginReleaseShellContextDelegate(WSManPluginManagedEntryWrapper.WSManPluginReleaseShellContext);
266266
_pluginReleaseShellContextGCHandle = GCHandle.Alloc(pluginReleaseShellContext);
267267
_unmanagedStruct.wsManPluginReleaseShellContextCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginReleaseShellContext);
268268
}
269269
{
270-
WSMPluginCommandDelegate pluginCommand = new WSMPluginCommandDelegate(WSManPluginManagedEntryWrapper.WSManPluginCommand);
270+
WSManPluginCommandDelegate pluginCommand = new WSManPluginCommandDelegate(WSManPluginManagedEntryWrapper.WSManPluginCommand);
271271
_pluginCommandGCHandle = GCHandle.Alloc(pluginCommand);
272272
_unmanagedStruct.wsManPluginCommandCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginCommand);
273273
}
274274
{
275-
WSMPluginReleaseCommandContextDelegate pluginReleaseCommandContext = new WSMPluginReleaseCommandContextDelegate(WSManPluginManagedEntryWrapper.WSManPluginReleaseCommandContext);
275+
WSManPluginReleaseCommandContextDelegate pluginReleaseCommandContext = new WSManPluginReleaseCommandContextDelegate(WSManPluginManagedEntryWrapper.WSManPluginReleaseCommandContext);
276276
_pluginReleaseCommandContextGCHandle = GCHandle.Alloc(pluginReleaseCommandContext);
277277
_unmanagedStruct.wsManPluginReleaseCommandContextCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginReleaseCommandContext);
278278
}
279279
{
280-
WSMPluginSendDelegate pluginSend = new WSMPluginSendDelegate(WSManPluginManagedEntryWrapper.WSManPluginSend);
280+
WSManPluginSendDelegate pluginSend = new WSManPluginSendDelegate(WSManPluginManagedEntryWrapper.WSManPluginSend);
281281
_pluginSendGCHandle = GCHandle.Alloc(pluginSend);
282282
_unmanagedStruct.wsManPluginSendCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginSend);
283283
}
284284
{
285-
WSMPluginReceiveDelegate pluginReceive = new WSMPluginReceiveDelegate(WSManPluginManagedEntryWrapper.WSManPluginReceive);
285+
WSManPluginReceiveDelegate pluginReceive = new WSManPluginReceiveDelegate(WSManPluginManagedEntryWrapper.WSManPluginReceive);
286286
_pluginReceiveGCHandle = GCHandle.Alloc(pluginReceive);
287287
_unmanagedStruct.wsManPluginReceiveCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginReceive);
288288
}
289289
{
290-
WSMPluginSignalDelegate pluginSignal = new WSMPluginSignalDelegate(WSManPluginManagedEntryWrapper.WSManPluginSignal);
290+
WSManPluginSignalDelegate pluginSignal = new WSManPluginSignalDelegate(WSManPluginManagedEntryWrapper.WSManPluginSignal);
291291
_pluginSignalGCHandle = GCHandle.Alloc(pluginSignal);
292292
_unmanagedStruct.wsManPluginSignalCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginSignal);
293293
}
294294
{
295-
WSMPluginConnectDelegate pluginConnect = new WSMPluginConnectDelegate(WSManPluginManagedEntryWrapper.WSManPluginConnect);
295+
WSManPluginConnectDelegate pluginConnect = new WSManPluginConnectDelegate(WSManPluginManagedEntryWrapper.WSManPluginConnect);
296296
_pluginConnectGCHandle = GCHandle.Alloc(pluginConnect);
297297
_unmanagedStruct.wsManPluginConnectCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginConnect);
298298
}
299299
{
300-
WSMShutdownPluginDelegate shutdownPlugin = new WSMShutdownPluginDelegate(WSManPluginManagedEntryWrapper.ShutdownPlugin);
300+
WSManShutdownPluginDelegate shutdownPlugin = new WSManShutdownPluginDelegate(WSManPluginManagedEntryWrapper.ShutdownPlugin);
301301
_shutdownPluginGCHandle = GCHandle.Alloc(shutdownPlugin);
302302
_unmanagedStruct.wsManPluginShutdownPluginCallbackNative = Marshal.GetFunctionPointerForDelegate(shutdownPlugin);
303303
}
304304

305305
if (!Platform.IsWindows)
306306
{
307-
WSMPluginOperationShutdownDelegate pluginShutDownDelegate = new WSMPluginOperationShutdownDelegate(WSManPluginManagedEntryWrapper.WSManPSShutdown);
308-
_WSMPluginOperationShutdownGCHandle = GCHandle.Alloc(pluginShutDownDelegate);
307+
WSManPluginOperationShutdownDelegate pluginShutDownDelegate = new WSManPluginOperationShutdownDelegate(WSManPluginManagedEntryWrapper.WSManPSShutdown);
308+
_WSManPluginOperationShutdownGCHandle = GCHandle.Alloc(pluginShutDownDelegate);
309309
_unmanagedStruct.wsManPluginShutdownCallbackNative = Marshal.GetFunctionPointerForDelegate(pluginShutDownDelegate);
310310
}
311311
}
@@ -328,7 +328,7 @@ private void CleanUpDelegates()
328328
_shutdownPluginGCHandle.Free();
329329
if (!Platform.IsWindows)
330330
{
331-
_WSMPluginOperationShutdownGCHandle.Free();
331+
_WSManPluginOperationShutdownGCHandle.Free();
332332
}
333333
}
334334
}

test/tools/WebListener/Controllers/ResponseController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public string Index()
4141
}
4242

4343
StringValues responsePhrase;
44-
if ( Request.Query.TryGetValue("responsephrase", out responsePhrase))
44+
if (Request.Query.TryGetValue("responsephrase", out responsePhrase))
4545
{
4646
Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = responsePhrase.FirstOrDefault();
4747
}

test/tools/WebListener/DeflateFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace mvc.Controllers
1111
{
1212
internal sealed class DeflateFilter : ResultFilterAttribute
1313
{
14-
public override async Task OnResultExecutionAsync( ResultExecutingContext context, ResultExecutionDelegate next)
14+
public override async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
1515
{
1616
var httpContext = context.HttpContext;
1717
using (var memoryStream = new MemoryStream())

test/tools/WebListener/GzipFilter.cs

Expand all lines: test/tools/WebListener/GzipFilter.cs
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace mvc.Controllers
1111
{
1212
internal sealed class GzipFilter : ResultFilterAttribute
1313
{
14-
public override async Task OnResultExecutionAsync( ResultExecutingContext context, ResultExecutionDelegate next)
14+
public override async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
1515
{
1616
var httpContext = context.HttpContext;
1717
using (var memoryStream = new MemoryStream())

0 commit comments

Comments
 (0)
0