Class: CC::CLI::ValidateConfig

Inherits:
Command
  • Object
show all
Defined in:
lib/cc/cli/validate_config.rb

Constant Summary collapse

NO_CONFIG_MESSAGE =
"No checked in config: nothing to validate.".freeze
TOO_MANY_CONFIG_MESSAGE =
"Don't commit both .codeclimate.yml & .codeclimate.json: only the JSON will be used.".freeze
SHORT_HELP =
"Validate your .codeclimate.yml or .codeclimate.json.".freeze
VALID_CONFIG_MESSAGE =
"No errors or warnings found in %s.".freeze

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



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cc/cli/validate_config.rb', line 9

def run
  require_json_or_yaml
  process_args

  if any_issues?
    display_issues
  else
    puts format(VALID_CONFIG_MESSAGE, validator.path)
  end

  exit 1 unless validator.valid?
end