skryukov / rubocop-gradual

Gradually improve your code with RuboCop
MIT License
36 stars 0 forks source link

Add built-in Rake tasks #7

Closed skryukov closed 2 years ago

skryukov commented 2 years ago

To use built-in Rake tasks add the following to your Rakefile:

# Rakefile
require "rubocop/gradual/rake_task"

RuboCop::Gradual::RakeTask.new

This will add rake tasks:

bundle exec rake -T
rake rubocop_gradual                  # Run RuboCop Gradual
rake rubocop_gradual:autocorrect      # Run RuboCop Gradual with autocorrect (only when it's safe)
rake rubocop_gradual:autocorrect_all  # Run RuboCop Gradual with autocorrect (safe and unsafe)
rake rubocop_gradual:check            # Run RuboCop Gradual to check the lock file

It's possible to customize the Rake task name and options:

# Rakefile

require "rubocop/gradual/rake_task"

RuboCop::Gradual::RakeTask.new(:custom_task_name) do |task|
  task.options = %w[--gradual-file custom_gradual_file.lock]
  task.verbose = false
end