rubyatscale / packs-rails

packs-rails establishes and implements a set of conventions for splitting up large monoliths.
MIT License
268 stars 26 forks source link

Exclude packs directory from rubocop-rails Cops targeting by default #91

Closed euglena1215 closed 5 months ago

euglena1215 commented 6 months ago

Hello,

I've noticed that files within the packs directory are not being targeted by some of the rubocop-rails Cops. This issue arises because the default configurations for these Cops specifically include paths like app/models/**/*.rb and potentially app/controllers/**/*.rb, but do not consider the packs directory.

ref. https://github.com/rubocop/rubocop-rails/blob/891de2254af9f4d4120b0fc5b5e127209851189f/config/default.yml#L139

For instance, if similar rules are applied to the controllers, this might cause oversight in code standards for files within packs. It may be beneficial to either adjust the default Include paths or provide guidance on how to ensure that packs directory files are also checked, as they are crucial parts of Rails applications.

Could you consider updating the configuration or documentation to address this coverage gap?

Thank you for looking into this issue.

perryqh commented 5 months ago

Thanks for the comment @euglena1215! We added some example rubocop-rails overrides in the readme. https://github.com/rubyatscale/packs-rails/pull/92

euglena1215 commented 5 months ago

Hello @perryqh, thank you for checking this out!

I noticed the method described in the README of the library seems quite effective as well. I opted for a slightly different approach by placing a rubocop.yml in each packs directory like this:

inherit_from: ../../.rubocop.yml

With this setup, we can calculate relative paths from the packs directory, eliminating the need to adjust the Include for each Cop. It's great to share beneficial methods like these. I'm looking forward to continuing to support this project!