Class: CC::CLI::Analyze

Inherits:
Command show all
Includes:
Analyzer
Defined in:
lib/cc/cli/analyze.rb,
lib/cc/cli/analyze/engine_failure.rb

Defined Under Namespace

Classes: EngineFailure

Constant Summary collapse

ARGUMENT_LIST =
"[-f format] [-e engine[:channel]] [path]".freeze
SHORT_HELP =
"Run analysis with the given arguments".freeze
HELP =
"#{SHORT_HELP}\n" \
"\n" \
"    -f <format>, --format <format>   Format of output. Possible values: #{CC::Analyzer::Formatters::FORMATTERS.keys.join ", "}\n" \
"    -e <engine[:channel]>            Engine to run. Can be specified multiple times.\n" \
"    --dev                            Run in development mode. Engines installed locally that are not in the manifest will be run.\n" \
"    path                             Path to check. Can be specified multiple times.".freeze

Constants included from Analyzer

Analyzer::UnreadableFileError

Constants inherited from Command

Command::CODECLIMATE_YAML, Command::NAMESPACE

Instance Method Summary collapse

Methods inherited from Command

[], abstract!, abstract?, all, command_name, #execute, help, inherited, #initialize, short_help, synopsis

Methods included from Output

#colorize, #fatal, #rainbow, #say, #success, #terminal, #warn

Constructor Details

This class inherits a constructor from CC::CLI::Command

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cc/cli/analyze.rb', line 19

def run
  # Load config here so it sees ./.codeclimate.yml
  @config = Config.load

  # process args after, so it modifies loaded configuration
  process_args

  bridge = Bridge.new(
    config: config,
    formatter: formatter,
    listener: CompositeContainerListener.new(
      LoggingContainerListener.new(Analyzer.logger),
      RaisingContainerListener.new(EngineFailure),
    ),
    registry: EngineRegistry.new,
  )

  bridge.run
end