-
-
Notifications
You must be signed in to change notification settings - Fork 17
GCI95 Use Is Operator Instead Of As Operator #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vdebellabre
merged 20 commits into
green-code-initiative:main
from
HerbigniauxBenoit:dev/RCS1172_UseIsOperatorInsteadOfAsOperator
May 21, 2025
Merged
GCI95 Use Is Operator Instead Of As Operator #92
vdebellabre
merged 20 commits into
green-code-initiative:main
from
HerbigniauxBenoit:dev/RCS1172_UseIsOperatorInsteadOfAsOperator
May 21, 2025
Conversation
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
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
src/Creedengo.Core/Analyzers/GCI95.UseIsOperatorInsteadOfAsOperator.cs
Outdated
Show resolved
Hide resolved
src/Creedengo.Tests/Tests/GCI95.UseIsOperatorInsteadOfAsOperator.Tests.cs
Show resolved
Hide resolved
…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>
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