Pattern: Comparing two identical operands
Issue: -
Comparing two identical operands is likely a mistake.
Examples of correct code:
1 == 2
foo == bar
prefixedFoo == foo
foo.aProperty == foo.anotherProperty
self.aProperty == self.anotherProperty
"1 == 1"
self.aProperty == aProperty
lhs.aProperty == rhs.aProperty
lhs.identifier == rhs.identifier
i == index
$0 == 0
keyValues?.count ?? 0 == 0
1 != 2
foo != bar
prefixedFoo != foo
foo.aProperty != foo.anotherProperty
self.aProperty != self.anotherProperty
"1 != 1"
self.aProperty != aProperty
lhs.aProperty != rhs.aProperty
lhs.identifier != rhs.identifier
i != index
$0 != 0
keyValues?.count ?? 0 != 0
1 === 2
foo === bar
prefixedFoo === foo
foo.aProperty === foo.anotherProperty
self.aProperty === self.anotherProperty
"1 === 1"
self.aProperty === aProperty
lhs.aProperty === rhs.aProperty
lhs.identifier === rhs.identifier
i === index
$0 === 0
keyValues?.count ?? 0 === 0
1 !== 2
foo !== bar
prefixedFoo !== foo
foo.aProperty !== foo.anotherProperty
self.aProperty !== self.anotherProperty
"1 !== 1"
self.aProperty !== aProperty
lhs.aProperty !== rhs.aProperty
lhs.identifier !== rhs.identifier
i !== index
$0 !== 0
keyValues?.count ?? 0 !== 0
1 > 2
foo > bar
prefixedFoo > foo
foo.aProperty > foo.anotherProperty
self.aProperty > self.anotherProperty
"1 > 1"
self.aProperty > aProperty
lhs.aProperty > rhs.aProperty
lhs.identifier > rhs.identifier
i > index
$0 > 0
keyValues?.count ?? 0 > 0
1 >= 2
foo >= bar
prefixedFoo >= foo
foo.aProperty >= foo.anotherProperty
self.aProperty >= self.anotherProperty
"1 >= 1"
self.aProperty >= aProperty
lhs.aProperty >= rhs.aProperty
lhs.identifier >= rhs.identifier
i >= index
$0 >= 0
keyValues?.count ?? 0 >= 0
1 < 2
foo < bar
prefixedFoo < foo
foo.aProperty < foo.anotherProperty
self.aProperty < self.anotherProperty
"1 < 1"
self.aProperty < aProperty
lhs.aProperty < rhs.aProperty
lhs.identifier < rhs.identifier
i < index
$0 < 0
keyValues?.count ?? 0 < 0
1 <= 2
foo <= bar
prefixedFoo <= foo
foo.aProperty <= foo.anotherProperty
self.aProperty <= self.anotherProperty
"1 <= 1"
self.aProperty <= aProperty
lhs.aProperty <= rhs.aProperty
lhs.identifier <= rhs.identifier
i <= index
$0 <= 0
keyValues?.count ?? 0 <= 0
func evaluate(_ mode: CommandMode) -> Result<AutoCorrectOptions, CommandantError<CommandantError<()>>>
Examples of incorrect code:
↓1 == 1
↓foo == foo
↓foo.aProperty == foo.aProperty
↓self.aProperty == self.aProperty
↓$0 == $0
↓1 != 1
↓foo != foo
↓foo.aProperty != foo.aProperty
↓self.aProperty != self.aProperty
↓$0 != $0
↓1 === 1
↓foo === foo
↓foo.aProperty === foo.aProperty
↓self.aProperty === self.aProperty
↓$0 === $0
↓1 !== 1
↓foo !== foo
↓foo.aProperty !== foo.aProperty
↓self.aProperty !== self.aProperty
↓$0 !== $0
↓1 > 1
↓foo > foo
↓foo.aProperty > foo.aProperty
↓self.aProperty > self.aProperty
↓$0 > $0
↓1 >= 1
↓foo >= foo
↓foo.aProperty >= foo.aProperty
↓self.aProperty >= self.aProperty
↓$0 >= $0
↓1 < 1
↓foo < foo
↓foo.aProperty < foo.aProperty
↓self.aProperty < self.aProperty
↓$0 < $0
↓1 <= 1
↓foo <= foo
↓foo.aProperty <= foo.aProperty
↓self.aProperty <= self.aProperty
↓$0 <= $0