C#: Add cs/constant-condition to the CCR suite. #18999
Merged
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.
In this PR we add the
cs/constant-conditionto the CCR suite.A couple of improvements related to the accuracy was made prior to this change
cs/constant-condition. #18976isMatchingConstant. #18932The available autofix triage data for C# only had 3 results where 2 were FPs (which were fixed by the above improvements) and for the last data point autofix gave an almost correct suggestion (at least a good staring point).
I have tried to run autofix locally on our query test data files, which provided pretty good fix suggestions. Most of these cases are constructed examples, where the correct suggestion is to delete the code as nothing is done (which autofix correctly detects). Furthermore, it is also able to correctly detect the logic error in the
Maxmethod (and provide a good fix for the implementation).Also ran autofix locally on the alerts for ASP.NET Core, which also provided good fix suggestions that could be directly applied.