Add Rubocop auto-correct rake task
Opened this issue · 1 comments
danman01 commented
This was very helpful in fixing rubocop offenses. It automatically fixes them, if possible: https://github.com/bbatsov/rubocop/wiki/Automatic-Corrections
--- a/lib/tasks/rubocop.rake
+++ b/lib/tasks/rubocop.rake
@@ -1,4 +1,6 @@
# frozen_string_literal: true
require 'rubocop/rake_task'
-RuboCop::RakeTask.new
+RuboCop::RakeTask.new(:rubocop) do |t|
+ t.options = ['-a']
+end
@jrhorn424 suggests having another rake task for this, so it's not the default, but is available.
danman01 commented
My workflow currently is running bin/rake
and then if there are rubocop errors, running rubocop -a
to auto-correct as many as possible.