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

Add Rubocop auto-correct rake task #20

Open
danman01 opened this issue Apr 4, 2017 · 1 comment
Open

Add Rubocop auto-correct rake task #20

danman01 opened this issue Apr 4, 2017 · 1 comment

Comments

@danman01
Copy link

danman01 commented Apr 4, 2017

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

My workflow currently is running bin/rake and then if there are rubocop errors, running rubocop -a to auto-correct as many as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant