diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 1114c63723..3f78a85dcd 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -8,8 +8,16 @@ module Homebrew Homebrew.install_gem_setup_path! "rubocop" - system "rubocop", "--format", "simple", "--config", - "#{HOMEBREW_LIBRARY}/.rubocop.yml", *target + 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