This project is read-only.

New Rule: NoAssignmentChaining

Apr 6, 2011 at 7:20 AM

StyleCop currently does not complain about the following snippet:

int a, b;
a = b = 2;

I think using multiple assignments on a single line is generally a sloppy shortcut which sometimes causes a maintainer to miss the fact that a given variable has in fact been assigned to properly (or an additional variable has been assigned to incorrectly).  It is much clearer to call out each assignment on their own line of code.  I propose adding a rule to call this out.

Apr 6, 2011 at 3:00 PM

I concur.

Apr 6, 2011 at 3:48 PM

Good rule.

Apr 8, 2011 at 4:05 PM

I agree also.