class RuboCop::CLI::Command::ShowCops

Shows the given cops, or all cops by default, and their configurations for the current directory. @api private

Public Class Methods

new(env) click to toggle source
Calls superclass method RuboCop::CLI::Command::Base::new
# File lib/rubocop/cli/command/show_cops.rb, line 12
def initialize(env)
  super

  # Load the configs so the require()s are done for custom cops
  @config = @config_store.for(Dir.pwd)
end

Public Instance Methods

run() click to toggle source
# File lib/rubocop/cli/command/show_cops.rb, line 19
def run
  print_available_cops
end

Private Instance Methods

config_lines(cop) click to toggle source
# File lib/rubocop/cli/command/show_cops.rb, line 67
def config_lines(cop)
  cnf = @config.for_cop(cop)
  cnf.to_yaml.lines.to_a.drop(1).map { |line| "  #{line}" }
end
cops_of_department(cops, department) click to toggle source
# File lib/rubocop/cli/command/show_cops.rb, line 63
def cops_of_department(cops, department)
  cops.with_department(department).sort!
end
print_available_cops() click to toggle source
print_cop_details(cops) click to toggle source
print_cops_of_department(registry, department, show_all) click to toggle source
selected_cops_of_department(cops, department) click to toggle source
# File lib/rubocop/cli/command/show_cops.rb, line 57
def selected_cops_of_department(cops, department)
  cops_of_department(cops, department).select do |cop|
    @options[:show_cops].include?(cop.cop_name)
  end
end