GCI95 Use Is Operator Instead Of As Operator#92
Merged
vdebellabre merged 20 commits intogreen-code-initiative:mainfrom May 21, 2025
Merged
Conversation
Added a test to ensure the analyzer does not trigger when the `as` operator is used in non-"not equals" comparisons, specifically for null checks.
…e the use of the 'is' operator instead of the 'as' operator in C#. Refactored the relevant files and added detailed logic for analyzing syntax nodes and reporting diagnostics for inappropriate 'as' usage. Comprehensive unit tests have been included to validate the functionality of the new analyzer across various scenarios.
StanleySweet
added a commit
to StanleySweet/creedengo-rules-specifications
that referenced
this pull request
May 20, 2025
… to GCI95_UseIsOperatorInsteadOfAsOperator to reflect a version increment or reorganization of diagnostic rules.
vdebellabre
requested changes
May 20, 2025
…he `UseIsOperatorInsteadOfAsOperator` class for improved readability. Added a new test in `UseIsOperatorInsteadOfAsOperatorTests` to ensure no diagnostics are reported when using the `as` operator with null conditional access, enhancing test coverage.
957d47a to
2150a0d
Compare
2150a0d to
0baaf89
Compare
vdebellabre
approved these changes
May 21, 2025
StanleySweet
added a commit
to StanleySweet/creedengo-rules-specifications
that referenced
this pull request
May 21, 2025
StanleySweet
added a commit
to StanleySweet/creedengo-rules-specifications
that referenced
this pull request
May 21, 2025
StanleySweet
added a commit
to StanleySweet/creedengo-rules-specifications
that referenced
this pull request
May 21, 2025
StanleySweet
added a commit
to StanleySweet/creedengo-rules-specifications
that referenced
this pull request
May 21, 2025
StanleySweet
added a commit
to StanleySweet/creedengo-rules-specifications
that referenced
this pull request
May 21, 2025
StanleySweet
added a commit
to StanleySweet/creedengo-rules-specifications
that referenced
this pull request
May 21, 2025
This is for green-code-initiative/creedengo-csharp#92 Co-authored-by: Benoit Herbigniaux <b.herbigniaux@hotmail.fr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement rule in Rosylnator :
Use 'is' operator instead of 'as' operator: RCS1172