Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
euglena1215 opened this issue Apr 19, 2024 · 2 comments
Closed
Labels
help wanted Extra attention is needed

Comments

@euglena1215
Copy link
Contributor

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
Copy link
Contributor

perryqh commented May 9, 2024

Thanks for the comment @euglena1215! We added some example rubocop-rails overrides in the readme. #92

@euglena1215
Copy link
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants