File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
lib/rubocop/rspec_rails/cop Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -88,13 +88,14 @@ task default: %i[build_config spec
8888desc 'Generate a new cop template'
8989task :new_cop , [ :cop ] do |_task , args |
9090 require 'rubocop'
91+ require_relative 'lib/rubocop/rspec_rails/cop/generator'
9192
9293 cop_name = args . fetch ( :cop ) do
9394 warn "usage: bundle exec rake 'new_cop[Department/Name]'"
9495 exit!
9596 end
9697
97- generator = RuboCop ::Cop ::Generator . new ( cop_name )
98+ generator = RuboCop ::RSpecRails :: Cop ::Generator . new ( cop_name )
9899 generator . write_source
99100 generator . write_spec
100101 generator . inject_require (
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module RuboCop
4+ module RSpecRails
5+ module Cop
6+ # Source and spec generator for new cops
7+ #
8+ # This generator will take a cop name and generate a source file
9+ # and spec file when given a valid qualified cop name.
10+ # @api private
11+ class Generator < RuboCop ::Cop ::Generator
12+ def todo
13+ <<~TODO
14+ Do 4 steps:
15+ 1. Modify the description of #{ badge } in config/default.yml
16+ 2. Implement your new cop in the generated file!
17+ 3. Add an entry about new cop to CHANGELOG.md
18+ 4. Commit your new cop with a message such as
19+ e.g. "Add new `#{ badge } ` cop"
20+ TODO
21+ end
22+ end
23+ end
24+ end
25+ end
You can’t perform that action at this time.
0 commit comments