Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 553 Bytes

GCop423.md

File metadata and controls

46 lines (37 loc) · 553 Bytes

GCop 423

"This condition was just checked on line {lineNumber}."

Rule description

Duplicate conditions are noisy, make long your code and reduce the readability of your code. When the same condition is repeated, it's just poorly formatted logic.

Example

if (someBooleanExpression)
{
    DoFirstThing();
}
else
{
   ...
}

if (someBooleanExpression)
{
    DoSecondThing();
}
else
{
  ...
}

should be 🡻

if (someBooleanExpression)
{
    DoFirstThing();
    DoSecondThing();
}
else
{
   ...
   ...
}