Sha256: e78003e91c51def680d4b7ee442c9913c293209da7036589e179a892c0c8725b
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
class BestPracticeProject::RubocopHandler < BestPracticeProject::BaseHandler def initialize(args) super @actual_config_path = File.realpath("#{File.dirname(__FILE__)}/config/rubocop.yml") if rails? @config_path = Rails.root.join(".rubocop.yml").to_s @todo_path = Rails.root.join(".rubocop_todo.yml").to_s else @config_path = ".rubocop.yml" @todo_path = ".rubocop_todo.yml" end end def command command = "bundle exec rubocop --display-cop-names" command << " --auto-correct" if ARGV.include?("auto-correct") command end def generate_config FileUtils.copy(@actual_config_path, @config_path) generate_todo_config puts "Generated Rubocop todo config in #{@todo_path}" puts "Generated Rubocop config in #{@config_path}" end def generate_todo_config rubocop_command = "rubocop --display-cop-names --auto-gen-config --config=#{@config_path}" rubocop_command << " --rails" if rails? system(rubocop_command) end def execute system(command) end def installed? require "rubocop" true rescue LoadError false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
best_practice_project-0.0.11 | lib/best_practice_project/rubocop_handler.rb |