mgechev / mgechev/revive

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

Open
#910 2 comments 0 reactions 0 assignees View on GitHub
feedback required no decision rule proposal
Dominant language
Go
Stars
5.6k
Forks
330
Avg merge
1d 21h
Merged PRs (30d)
9

Description

**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.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing increment-decrement rule and reviewing its tests. Clarify which non-loop-counter uses should be reported while leaving loop-counter usage alone; finish with focused rule tests and the full Go test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.