2015-01-02 13:36:26 +00:00
|
|
|
module Homebrew
|
|
|
|
def style
|
|
|
|
target = if ARGV.named.empty?
|
|
|
|
[HOMEBREW_LIBRARY]
|
2015-08-06 15:39:08 +08:00
|
|
|
elsif ARGV.named.any? { |file| File.exist? file }
|
|
|
|
ARGV.named
|
2015-01-02 13:36:26 +00:00
|
|
|
else
|
|
|
|
ARGV.formulae.map(&:path)
|
|
|
|
end
|
|
|
|
|
2016-04-14 14:44:23 +01:00
|
|
|
Homebrew.install_gem_setup_path! "rubocop", "0.39"
|
2015-01-02 13:36:26 +00:00
|
|
|
|
2015-03-13 11:09:32 +01:00
|
|
|
args = [
|
2015-08-02 14:56:01 +01:00
|
|
|
"--format", "simple", "--force-exclusion", "--config",
|
2015-09-09 15:58:33 +01:00
|
|
|
"#{HOMEBREW_LIBRARY}/.rubocop.yml",
|
2015-03-13 11:09:32 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
args << "--auto-correct" if ARGV.homebrew_developer? && ARGV.flag?("--fix")
|
|
|
|
|
|
|
|
args += target
|
|
|
|
|
|
|
|
system "rubocop", *args
|
2015-01-02 13:36:26 +00:00
|
|
|
Homebrew.failed = !$?.success?
|
|
|
|
end
|
|
|
|
end
|