Only define rubocop tasks in the dev env

This broke loading the rake tasks in the production environment as we only have
rubocop in development.
This commit is contained in:
Henne Vogelsang 2019-05-07 15:39:49 +02:00
parent 0b6d18e3d3
commit 3f07a8e68c
No known key found for this signature in database
GPG key ID: 9D6164C2955FADE0

View file

@ -1,16 +1,17 @@
# frozen_string_literal: true
require 'rubocop/rake_task'
unless Rails.env.production?
require 'rubocop/rake_task'
namespace :rubocop do
desc 'Generate .rubocop_todo.yml'
task :auto_gen_config do
sh 'rubocop --display-cop-names --auto-gen-config --auto-gen-only-exclude'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = []
task.options = ['--display-cop-names']
end
namespace :rubocop do
desc 'Generate .rubocop_todo.yml'
task :auto_gen_config do
sh 'rubocop --display-cop-names --auto-gen-config --auto-gen-only-exclude'
end
end
end
desc 'Run RuboCop on the whole project'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = []
task.options = ['--display-cop-names']
end