regal icon indicating copy to clipboard operation
regal copied to clipboard

Rule: `unnecessary-unification`

Open anderseknert opened this issue 2 years ago • 1 comments

Avoid

input.number = 5

Prefer

input.number == 5

Motivation: while there are a few valid cases for unification, the unification operator (=) should not be used for simple comparison. TBD — more comprehensive explanation.

anderseknert avatar Jan 24 '23 15:01 anderseknert

Merging this issue with #3 as I think a single rule to cover this is better, and more likely easier to implement as well. Rather than trying to detect if the intent is assignment or comparison, simply check whether the unification operator is necesseray at all. The cases where the unification operator is "necessary" are few, I think. Too tired to think right now 😅 @srenatus any good example cases you can think of?

anderseknert avatar Oct 30 '23 20:10 anderseknert