Class: RuboCop::CLI::Command::ShowCops Private

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cli/command/show_cops.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

Defined Under Namespace

Classes: ExactMatcher, WildcardMatcher

Instance Attribute Summary

Attributes inherited from Base

#env

Instance Method Summary collapse

Methods inherited from Base

by_command_name, inherited

Constructor Details

#initialize(env) ⇒ ShowCops

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ShowCops.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rubocop/cli/command/show_cops.rb', line 24

def initialize(env)
  super

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

  @cop_matchers = @options[:show_cops].map do |pattern|
    if pattern.include?('*')
      WildcardMatcher.new(pattern)
    else
      ExactMatcher.new(pattern)
    end
  end
end

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/rubocop/cli/command/show_cops.rb', line 39

def run
  print_available_cops
end
OSZAR »