mattbrictson / nextgen

Generate your next Rails app interactively! This template includes production-ready recommendations for testing, security, developer productivity, and modern frontends. Plus optional Vite support! ⚡️
MIT License
274 stars 7 forks source link

Explicitly set config path in RuboCop task #105

Closed mattbrictson closed 2 months ago

mattbrictson commented 2 months ago

When a specific config path is not passed to RuboCop, it will search for configs in parent directories, which can have unexpected side-effects. E.g. when testing nextgen, I would often run into this when generating an app in a subdirectory of nextgen, which has its own RuboCop config. The config in the generated app and in the parent directory would be merged, leading to failures.

This PR updates the rubocop rake task to explicitly set the config path, fixing this problem. It also mirrors a similar fix provided by Rails itself in the bin/rubocop binstub: https://github.com/rails/rails/blob/e1d58cfd05ae1cc0bfc1006b7ce973a7730831df/railties/lib/rails/generators/rails/app/templates/bin/rubocop.tt#L4-L5