Fix S6966 FPs/FNs: FPs/FNs after peach validation#9222
Fix S6966 FPs/FNs: FPs/FNs after peach validation#9222mary-georgiou-sonarsource merged 8 commits intomasterfrom
Conversation
mary-georgiou-sonarsource
left a comment
There was a problem hiding this comment.
Some suggestions and I think we miss a UT.
| if (original == awaitableRoot && result is ExpressionSyntax resultExpression) | ||
| { | ||
| result = SyntaxFactory.AwaitExpression(resultExpression); | ||
| result = SyntaxFactory.ParenthesizedExpression( |
There was a problem hiding this comment.
Is is possible to add a test that fails if this line is not changed to add parentheses around the replacement?
There was a problem hiding this comment.
No. This is not possible. This is the funny part with SyntaxTree manipulations: You can end up with a syntax tree that is not expressible in code (If you take the transformed syntax tree, convert it to code, and convert it back to a tree, the new tree looks different). The parentheses are not needed in the tree because the tree looks like parentheses are present. The parentheses will be needed for the code fix though.
With the parentheses, debugging is a bit better because the text representation of the syntax tree is better.
I can remove all the trivia and parentheses handling because, for the speculative binding, they are not needed.
There was a problem hiding this comment.
Maybe add a quick comment there to capture this?
On why there are parentheses.
There was a problem hiding this comment.
I'll merge this to make it to the next release. Let's add a comment in one of the next PRs.
I'll keep a task on my calendar to not forget.
mary-georgiou-sonarsource
left a comment
There was a problem hiding this comment.
LGTM - there's couple more suggestions.
There's also a code smell for an unused parameter stayed after refactoring.
|
|




S6966 - Awaitable method should be used
See #9179 (comment)