mgechev/revive

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

开放

#910 创建于 2023年9月29日

 (1 条评论) (0 个反应) (0 位负责人)Go (316 个派生)github user discovery
good first issuerule proposal

仓库指标

星标
 (5,517 个星标)
PR 合并指标
 (平均合并 10小时 48分钟) (30 天内合并 3 个 PR)

描述

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.

贡献者指南