Fix IDE0083: UseNotPattern#26213
Conversation
|
@iSazonov Please approve workflows. |
|
@TravisEz13 Please could you review. |
|
/azp run PowerShell-CI-linux-packaging, PowerShell-Windows-Packaging-CI |
There was a problem hiding this comment.
Pull Request Overview
This PR applies IDE0083 code style rule to modernize pattern matching by converting negated is expressions to use the not pattern. The changes update 13 files to replace the older if (!(expression is Type variable)) syntax with the more concise if (expression is not Type variable) pattern.
- Updates pattern matching syntax to use C# 9.0
notpattern - Improves code readability and consistency with modern C# style
- No functional changes, only syntactic improvements
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ServerRemoteHost.cs | Updates negated type check for RemoteRunspace |
| InitialSessionStateProvider.cs | Updates negated type check for Hashtable |
| EncodeAndDecode.cs | Updates negated type checks for PSObject |
| RunspaceConnectionInfo.cs | Updates negated type check for WSManConnectionInfo |
| ReceivePSSession.cs | Updates negated type check for RemoteRunspace |
| InvokeCommandCommand.cs | Updates negated type check for ExecutionCmdletHelperRunspace |
| CustomShellCommands.cs | Updates negated type check for Hashtable |
| remoterunspaceinfo.cs | Updates negated type check for RemoteRunspace |
| RemoteRunspacePoolInternal.cs | Updates negated type check for WSManConnectionInfo |
| JobSourceAdapter.cs | Updates negated type checks for Job2 |
| Job.cs | Updates negated type checks for RuntimeException, RemoteException, and PSRemotingChildJob |
| ClientMethodExecutor.cs | Updates negated type check for IHostSupportsInteractiveSession |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
|
📣 Hey @@xtqqczze, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0083
Contributes to #26230.