class Swiftlint < Formula desc "Tool to enforce Swift style and conventions" homepage "https://github.com/realm/SwiftLint" url "https://github.com/realm/SwiftLint.git", :tag => "0.26.0", :revision => "8c5d2afa7c8f58bb8302cc5cc679b64741490982" head "https://github.com/realm/SwiftLint.git" bottle do cellar :any_skip_relocation sha256 "d2fdae3eec236738b61de63f239ea379c97baa1e5c99efd0f38b6d9a3f3cd754" => :high_sierra sha256 "6d78e398bf2404e001d9181f9f4fefc0b911ea6d5c79a825c6e5bdebe2f3b272" => :sierra end depends_on :xcode => "8.0" depends_on :xcode => ["9.0", :build] def install ENV["CC"] = Utils.popen_read("xcrun -find clang").chomp # rdar://40724445 system "make", "prefix_install", "PREFIX=#{prefix}", "TEMPORARY_FOLDER=#{buildpath}/SwiftLint.dst" end test do (testpath/"Test.swift").write "import Foundation" assert_match "#{testpath}/Test.swift:1: warning: Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)", shell_output("SWIFTLINT_SWIFT_VERSION=3 #{bin}/swiftlint").chomp assert_match version.to_s, shell_output("#{bin}/swiftlint version").chomp end end