Open michaeljb opened 1 week ago
For the above list, I looked at comments on PRs from with this search link https://www.github.com/tobymao/18xx/pulls?page=1&q=is%3Apr+commenter%3Atobymao+is%3Aclosed from PR 10720, back through PR 8592 on January 1, 2023
update: Now checked through January 1, 2022, back through PR 6696. Might go through more later, 2021 is on pages 23-60, and 2020 on pages 61-99, both a lot more active than 2022 and 2023
Here's a suggestion to use .any?
with no block instead of !.compact.empty?
-- currently the NoBlocklessAny
cop prefers !.compact.entity?
https://www.github.com/tobymao/18xx/pull/8424#discussion_r988546410
Assuming cop config allows this, probably a lot of these could be handled in one cop where unwanted method names and their suggested replacements are put into the config. For a generalized cop like that, auto-correct probably would not work.
Ideas for more cops based on PR comments
nil?
, use truthiness checks instead[0]
instead of.first
index { }
instead offind_index { }
size
instead oflength
orcount
count
isn't actually the same, but maybe that's an indication the attr should be renamed fromcount
)flat_map
reject
/select
instead ofdelete_if
/filter
Random
empty?
instead ofnone?
(if no block given onnone?
)map { }.map { }
**kwargs
empty?
instead of!size.positive?
cops that probably already exist
puts
orprint
&&
notand
other ideas
int/int
returnsint
while in JSint/int
returns a floating point number, so maybe a cop that looks forint / int
?