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

Opposite of increment-decrement (for non-loop-counter usage) #910

Open
scop opened this issue Sep 29, 2023 · 1 comment
Open

Opposite of increment-decrement (for non-loop-counter usage) #910

scop opened this issue Sep 29, 2023 · 1 comment
Labels

Comments

@scop
Copy link
Contributor

scop commented Sep 29, 2023

Is your feature request related to a problem? Please describe.

The increment-decrement rule is quite opinionated, as many rules are. However, its suggestion is problematic in the sense that e.g.

  • it's not that common of a practice in my experience to use ++/-- in contexts other than loop counters in Go code, e.g. stdlib
  • many programming languages don't even have those operators (for example Python, Rust, Swift, Zig)

Describe the solution you'd like

increment-decrement can be disabled like all others, no problem with that, and that does not require a solution.

But for the above reasons, a rule that would do the opposite of increment-decrement for anything but loop counters would be nice to have.

Describe alternatives you've considered

Just disabling increment-decrement, but that won't help with adoption of the += 1 style.

Additional context

N/A.

@chavacava
Copy link
Collaborator

Hi @scop, thank you for the proposal.
PR are welcome.

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

No branches or pull requests

2 participants