Rakefile in rubocop-rspec-1.21.0 vs Rakefile in rubocop-rspec-1.22.0
- old
+ new
@@ -43,5 +43,24 @@
raise "default.yml is out of sync:\n\n#{stdout.read}\nRun bin/build_config"
end
end
task default: %i[build_config coverage internal_investigation confirm_config]
+
+desc 'Generate a new cop template'
+task :new_cop, [:cop] do |_task, args|
+ require 'rubocop'
+
+ cop_name = args.fetch(:cop) do
+ warn 'usage: bundle exec rake new_cop[Department/Name]'
+ exit!
+ end
+
+ generator = RuboCop::Cop::Generator.new(cop_name)
+
+ generator.write_source
+ generator.write_spec
+ generator.inject_require(root_file_path: 'lib/rubocop/cop/rspec_cops.rb')
+ generator.inject_config(config_file_path: 'config/default.yml')
+
+ puts generator.todo
+end