michaeljb / rubocop-g18xx

custom rubocop plugin for 18xx.games (tobymao/18xx)
MIT License
0 stars 0 forks source link

Cop ideas #1

Open michaeljb opened 1 week ago

michaeljb commented 1 week ago

Ideas for more cops based on PR comments

cops that probably already exist

other ideas

michaeljb commented 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

michaeljb commented 1 week ago

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

michaeljb commented 1 week ago

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.

michaeljb commented 1 day ago

enforce ::Set instead of Set: