Class: GazelleStyleguide::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/gazelle_styleguide/cli.rb

Overview

Command line tool for managing linter running and pre-commits

Constant Summary collapse

GENERIC_CHECKS =
'jshint, merge_conflict, json, yaml, coffeelint, scss_lint'
JAVA_CHECKS =
'checkstyle'
RUBY_CHECKS =
'rubocop, rspec_focus'

Instance Method Summary collapse

Instance Method Details

#fix(*files) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/gazelle_styleguide/cli.rb', line 37

def fix(*files)
  require 'rubocop'
  files = lint_files(files, options).select{|file| file =~ /\.rb|Gemfile|Rakefile|\.task|\.rake/}
  args = ['-a', '-c', GazelleStyleguide.config_for('rubocop.yml')] + files
  args.unshift('-d') if options[:debug]

  Rubocop::CLI.new.run(args)
end

#initObject



15
16
17
18
19
# File 'lib/gazelle_styleguide/cli.rb', line 15

def init
  setup_git_config
  install_pre_commit
  setup_houndci
end

#lint(*files) ⇒ Object



25
26
27
28
29
30
# File 'lib/gazelle_styleguide/cli.rb', line 25

def lint(*files)
  require 'pre-commit'
  files = lint_files(files, options)

  PreCommit::Runner.new($stderr, files).run
end