class RuboCop::Cop::Generator
Source and test generator for new cops
This generator will take a cop name and generate a source file and test file when given a valid qualified cop name.
Constants
- TEST_TEMPLATE
Public Instance Methods
write_test()
click to toggle source
# File lib/rubocop/cop/generator.rb, line 35 def write_test write_unless_file_exists(test_path, generated_test) end
Private Instance Methods
generated_test()
click to toggle source
# File lib/rubocop/cop/generator.rb, line 51 def generated_test generate(TEST_TEMPLATE) end
test_path()
click to toggle source
# File lib/rubocop/cop/generator.rb, line 41 def test_path File.join( 'test', 'rubocop', 'cop', 'minitest', "#{snake_case(badge.cop_name.to_s)}_test.rb" ) end