Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider disabling RCS1089 (preference for ++ over +=) #39

Open
idg10 opened this issue Feb 14, 2022 · 0 comments
Open

Consider disabling RCS1089 (preference for ++ over +=) #39

idg10 opened this issue Feb 14, 2022 · 0 comments

Comments

@idg10
Copy link
Contributor

idg10 commented Feb 14, 2022

Roslynator's RCS1089 warning: Use ++ operator instead of assignment. crops up a lot. It doesn't like this:

count += 1;

and tells you to change it to this:

count++;

I don't like the suggestion in these examples because these statements are purely about the side-effect, so I prefer the presence of an = symbol to emphasize that. My view is that the ++ operators might be a better idiomatic fit in cases where you are also using the value (although compound assignment returns the value in addition to having a side effect, so you can use that in those cases too) but I don't really see any benefit in using ++ in the case shown above, and I see a downside.

I've disabled this warning in a few projects using `Endjin.RecommendedPractices, so I would like to make this part of our defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant