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
88
88
desc 'Generate a new cop template'
89
89
task :new_cop , [ :cop ] do |_task , args |
90
90
require 'rubocop'
91
+ require_relative 'lib/rubocop/rspec_rails/cop/generator'
91
92
92
93
cop_name = args . fetch ( :cop ) do
93
94
warn "usage: bundle exec rake 'new_cop[Department/Name]'"
94
95
exit!
95
96
end
96
97
97
- generator = RuboCop ::Cop ::Generator . new ( cop_name )
98
+ generator = RuboCop ::RSpecRails :: Cop ::Generator . new ( cop_name )
98
99
generator . write_source
99
100
generator . write_spec
100
101
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