Enable Style/NumericPredicate RuboCop
Description of the proposal
Enables Style/NumericPredicate comparison
# EnforcedStyle: comparison
# bad
foo.zero?
foo.negative?
bar.baz.positive?
# good
foo == 0
0 > foo
bar.baz > 0
Due to performance concerns in !36221 (comment 375659681), we want to enable comparison instead of the default.
Check-list
-
Make sure this MR enables a static analysis check rule for new usage but ignores current offenses -
Mention this proposal in the relevant Slack channels (e.g. #development
,#backend
,#frontend
) -
The MR doesn't have significant objections, and is getting a majority of 👍 vs👎 (remember that we don't need to reach a consensus) -
Create a follow-up issue to fix the current offenses as a separate iteration: https://gitlab.com/gitlab-org/gitlab/-/issues/228858 -
Follow the review process as usual -
Once approved and merged by a maintainer, mention it again: -
In the relevant Slack channels (e.g. #development
,#backend
,#frontend
) -
(Optional depending on the impact of the change) In the Engineering Week in Review
-
Edited by Doug Stull