Enable IDE0083: UseNotPattern#26231
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enables the IDE0083 code style analyzer rule by upgrading it from "silent" to "warning" severity and refactors existing code to use the modern "is not" pattern syntax instead of the older "!(x is Type)" negated type check pattern. This improves code readability and aligns with current C# best practices.
Key changes:
- Updated .globalconfig to enforce IDE0083 as a warning
- Replaced negated type checks
!(x is Type)with the cleanerx is not Typepattern across multiple files
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .globalconfig | Changed IDE0083 severity from silent to warning to enforce the pattern |
| src/System.Management.Automation/help/ProviderContext.cs | Modernized type check pattern in provider help retrieval |
| src/System.Management.Automation/help/CommandHelpProvider.cs | Modernized type check pattern in help data processing |
| src/System.Management.Automation/engine/parser/ast.cs | Updated multiple type check patterns in AST-related methods including equality checks and value assignments |
| src/System.Management.Automation/engine/parser/TypeResolver.cs | Modernized type check pattern in equality comparison |
| src/System.Management.Automation/engine/parser/TypeInferenceVisitor.cs | Updated type check patterns in type inference logic |
| src/System.Management.Automation/engine/parser/SemanticChecks.cs | Modernized type check patterns in semantic validation |
| src/System.Management.Automation/engine/parser/Position.cs | Updated type check pattern in extent equality check |
| src/System.Management.Automation/engine/parser/Parser.cs | Modernized type check patterns in hashtable parsing |
| src/System.Management.Automation/engine/parser/ConstantValues.cs | Updated type check patterns in constant value visitors |
| src/System.Management.Automation/engine/parser/Compiler.cs | Modernized type check patterns in binary expression compilation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0083
Fix #26230