aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/style.rb
blob: 3f78a85dcdd6bdcd416bf9eb9733e57fae9fec4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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