Baptiste Fontaine 04508b0c4d brew style: --fix to auto-correct issues.
Closes Homebrew/homebrew#37670.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-03-13 13:21:15 +00:00

24 lines
460 B
Ruby

module Homebrew
def style
target = if ARGV.named.empty?
[HOMEBREW_LIBRARY]
else
ARGV.formulae.map(&:path)
end
Homebrew.install_gem_setup_path! "rubocop"
args = [
"--format", "simple", "--config",
"#{HOMEBREW_LIBRARY}/.rubocop.yml"
]
args << "--auto-correct" if ARGV.homebrew_developer? && ARGV.flag?("--fix")
args += target
system "rubocop", *args
Homebrew.failed = !$?.success?
end
end