Class: CC::CLI::Analyze

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

Constant Summary

Constants included from Analyzer

Analyzer::UnreadableFileError

Constants inherited from Command

Command::CODECLIMATE_YAML

Instance Method Summary collapse

Methods inherited from Command

command_name, #execute, #fatal, #require_codeclimate_yml, #say, #warn

Constructor Details

#initialize(_args = []) ⇒ Analyze

Returns a new instance of Analyze.



6
7
8
9
10
11
12
13
# File 'lib/cc/cli/analyze.rb', line 6

def initialize(_args = [])
  super
  @engine_options = []
  @path_options = []

  process_args
  apply_config_options
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cc/cli/analyze.rb', line 15

def run
  require_codeclimate_yml

  Dir.chdir(ENV['FILESYSTEM_DIR']) do
    runner = EnginesRunner.new(registry, formatter, source_dir, config, path_options)
    runner.run
  end

rescue EnginesRunner::InvalidEngineName => ex
  fatal(ex.message)
rescue EnginesRunner::NoEnabledEngines
  fatal("No enabled engines. Add some to your .codeclimate.yml file!")
end