mgechev/revive

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

オープン

#910 opened on 2023/09/29

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)Go (316 件のフォーク)github user discovery
good first issuerule proposal

Repository metrics

Stars
 (5,517 個のスター)
PR merge metrics
 (平均マージ 10h 48m) (30d で 3 merged PRs)

説明

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.

コントリビューターガイド