dotnet / roslynator

Roslynator is a set of code analysis tools for C#, powered by Roslyn.

Home Page:https://josefpihrt.github.io/docs/roslynator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify numeric comparison

josefpihrt opened this issue · comments

(a - b) == 0 => a == b
(a - b) > 0 => a > b
(a - b) >= 0 => a >= b
(a - b) < 0 => a < b
(a - b) <= 0 => a <= b

Maybe add to RCS1195

Hello, I'm interested in resolving this issue and would appreciate it if you could assign it to me.

Great!

I'm just thinking about whether to create new analyzer or whether to add this functionality to some existing analyzer. I think that it could be added to https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1195. And the analyzer would be renamed to "Simplify binary expression".

I would create a new analyzer and then add it to BinaryExpressionCodeFixProvider.
Is it ok?

And what would be a name of the analyzer?

I would name it the SimplifyNumericComparisonAnalyzer.

Agreed.