Module: Rubocop::Stylecheck::Cli

Defined in:
lib/rubocop/stylecheck/cli.rb

Class Method Summary collapse

Class Method Details

.optionsObject



11
12
13
14
15
# File 'lib/rubocop/stylecheck/cli.rb', line 11

def options
  options = ["--fail-level", "refactor"]
  options += ["--rails"] if defined?(Rails)
  options
end

.options_with_auto_correctObject



17
18
19
# File 'lib/rubocop/stylecheck/cli.rb', line 17

def options_with_auto_correct
  options + ["--auto-correct"]
end

.options_with_copObject



21
22
23
# File 'lib/rubocop/stylecheck/cli.rb', line 21

def options_with_cop
  options + ["--display-cop-names"]
end

.run(options) ⇒ Object



5
6
7
8
9
# File 'lib/rubocop/stylecheck/cli.rb', line 5

def run(options)
  system "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
    abort "Fix code style errors" unless ok
  end
end