I suspect this one might be difficult but I think it would be very useful.
New analyzer:
I deal with a lot of code that has if then statements that have very similar expressions in the two branches. CC0014 'You can use a ternary operator' helps but I would like to go furher and take common sub-expressions out of the two branches and place them before the ternary.
Before:
After:
a, b,c, and d are arbitrary expressions not necessarily simple variable references.
Diagnostic Id: CC0115
Category: Style
Severity: Warning
I suspect this one might be difficult but I think it would be very useful.
New analyzer:
I deal with a lot of code that has if then statements that have very similar expressions in the two branches. CC0014 'You can use a ternary operator' helps but I would like to go furher and take common sub-expressions out of the two branches and place them before the ternary.
Before:
After:
a, b,c, and d are arbitrary expressions not necessarily simple variable references.
Diagnostic Id:
CC0115Category:
StyleSeverity:
Warning