RalfKoban / MiKo-Analyzers

Provides analyzers that are based on the .NET Compiler Platform.
MIT License
13 stars 1 forks source link

Report AND / OR expressions that do the same on left and right side #1000

Closed RalfKoban closed 3 weeks ago

RalfKoban commented 2 months ago

We should report AND / OR conditions that do the same comparison on both sides (left and right).

Example for AND:

if (x == 42 && x == 42)

Example for OR:

if (x == 42 || x == 42)

Both should be fixed to:

if (x == 42)

Be also aware of unneeded parenthesis on one side:

if (x == 42 || (x == 42))
RalfKoban commented 2 months ago

PR contained wrong ID, so this is not resolved