Class: OpenvoxLint::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/openvox-lint/cli.rb

Overview

Command-line interface for openvox-lint.

Instance Method Summary collapse

Constructor Details

#initialize(args = ARGV) ⇒ CLI

Returns a new instance of CLI.



8
9
10
# File 'lib/openvox-lint/cli.rb', line 8

def initialize(args = ARGV)
  @args = args
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/openvox-lint/cli.rb', line 12

def run
  OpenvoxLint.reset_configuration!
  @config = OpenvoxLint.configuration
  parse_options
  load_rc_file
  if @list_checks
    list_checks; return 0
  end
  files = @args.empty? ? ['.'] : @args
  linter = Linter.new(configuration: @config)
  linter.run(*files)
  Report.new(@config).format(linter.problems)
  print_summary(linter) unless @config.log_format == 'json'
  linter.exit_code
end