Closed Earlopain closed 1 week ago
Thank you!!
Probably years late to this party, but I just started adding this to my projects:
# config/environments/development.rb
# Run Rubocop after generating files
Rails.application.configure do
config.generators.after_generate do |files|
parsable_files = files.filter { |file| file.end_with?('.rb') }
system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true) unless parsable_files.empty?
end
end
https://github.com/rails/rails/pull/50506 will expose it nicely with a rails config option, you'll probably like that then. Though I wonder if doing unsafe autocorrect is a sane default :thinking:
Oh nice! Thanks for sharing that Rails change!
Though I wonder if doing unsafe autocorrect is a sane default 🤔
Unfortunately, the ones I'm most likely to forget, like Frozen String Literals, are unsafe ðŸ˜
Very small nit. All the other current migrations follow the RuboCop rule. It's erb so RuboCop doesn't know about it.