class ClintEastwood::CLI

Clint Eastwood command line interface

Public Instance Methods

lint() click to toggle source
# File lib/clint_eastwood/cli.rb, line 20
def lint
  clint = load_and_configure

  # rubocop:disable Rails/Output
  if clint.enforce
    puts 'Project passed the linter successfully'
  else
    if options[:warn]
      puts 'Linting Failed'
    else
      abort('Linting Failed')
    end
  end
  # rubocop:enable Rails/Output
end

Private Instance Methods

load_and_configure() click to toggle source

Loads and configures clint

@returns A configured ClintEastwood::TheEnforcer object

# File lib/clint_eastwood/cli.rb, line 41
def load_and_configure
  path = options[:path] || File.expand_path('.')

  disable_rbp = options['disable-rbp'] || false
  disable_rubocop = options['disable-rubocop'] || false
  disable_reek = options['disable-reek'] || false
  disable_flog = options['disable-flog'] || false
  disable_flay = options['disable-flay'] || false

  ClintEastwood::TheEnforcer.new(
    path,
    lint: options[:lint],
    disable_rbp: disable_rbp,
    disable_rubocop: disable_rubocop,
    disable_reek: disable_reek,
    disable_flog: disable_flog,
    disable_flay: disable_flay
  )
end