Class: Evilution::CLI::Commands::Run

Inherits:
Evilution::CLI::Command show all
Defined in:
lib/evilution/cli/commands/run.rb

Instance Method Summary collapse

Methods inherited from Evilution::CLI::Command

#initialize

Constructor Details

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

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/evilution/cli/commands/run.rb', line 15

def call
  file_options = Evilution::Config.file_options
  config = nil
  raise Evilution::ConfigError, @stdin_error if @stdin_error

  config = Evilution::Config.new(**@options, target_files: @files, line_ranges: @line_ranges)
  hooks = build_hooks(config)
  runner = Evilution::Runner.new(config: config, hooks: hooks)
  summary = runner.call
  exit_code = summary.success?(min_score: config.min_score) ? 0 : 1
  Evilution::CLI::Result.new(exit_code: exit_code)
rescue Evilution::Error => e
  handle_error(e, config, file_options)
end