Sha256: 4f2904d9fe4bf758abcc186caf41aec74fc505f01a266c0cb4b310944d2c03ac

Contents?: true

Size: 701 Bytes

Versions: 4

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

require 'rubocop'

desc 'Generate a new cop template'
task :new_cop, [:cop] do |_task, args|
  cop_name = args.fetch(:cop) do
    warn 'usage: bundle exec rake new_cop[Department/Name]'
    exit!
  end

  github_user = `git config github.user`.chop
  github_user = 'your_id' if github_user.empty?

  generator = RuboCop::Cop::Generator.new(cop_name, github_user)

  generator.write_source
  generator.write_spec
  generator.inject_require(root_file_path: 'lib/rubocop/cop/itamae_cops.rb')

  begin
    generator.inject_config(config_file_path: 'config/default.yml')
  rescue TypeError # rubocop:disable Lint/HandleExceptions
    # nop
  end

  # puts generator.todo
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-itamae-0.1.1 tasks/new_cop.rake
rubocop-itamae-0.1.0 tasks/new_cop.rake
rubocop-itamae-0.1.0.alpha2 tasks/new_cop.rake
rubocop-itamae-0.1.0.alpha1 tasks/new_cop.rake