Skip to content

Instantly share code, notes, and snippets.

@norio-nomura
Last active February 15, 2017 00:31
Show Gist options
  • Save norio-nomura/85b96a77ba206f61e039ff17f362de04 to your computer and use it in GitHub Desktop.
Save norio-nomura/85b96a77ba206f61e039ff17f362de04 to your computer and use it in GitHub Desktop.
Test using both `: xcode => [" 7.0 ",: run]` and `: xcode => [" 8.0 ",: build]` with `swiftlint.rb`
OS-X-1011:~ norio$ cat /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/swiftlint.rb
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.16.1",
:revision => "16ca04905c769657c22e3a02435992b41ddfdc52"
head "https://github.com/realm/SwiftLint.git"
bottle do
cellar :any
sha256 "4f7826cd02501f11a39daf41a5752a1c4df4d047416d856c959378212748d695" => :sierra
sha256 "ff0453102251cd2b3e5d8c7d1cc951818ee4e4a2e6f0e9b635892dc1c32fdb41" => :el_capitan
end
depends_on :xcode => ["7.0", :run]
depends_on :xcode => ["8.0", :build]
def install
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
OS-X-1011:~ norio$ brew info swiftlint
swiftlint: stable 0.16.1 (bottled), HEAD
Tool to enforce Swift style and conventions
https://github.com/realm/SwiftLint
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/swiftlint.rb
==> Requirements
Build: git ✔, xcode ✘
Required: xcode ✔
OS-X-1011:~ norio$ sudo xcode-select -s /Library/Developer/CommandLineTools/
Password:
OS-X-1011:~ norio$ brew info swiftlint
swiftlint: stable 0.16.1 (bottled), HEAD
Tool to enforce Swift style and conventions
https://github.com/realm/SwiftLint
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/swiftlint.rb
==> Requirements
Build: git ✔, xcode ✘
Required: xcode ✘
OS-X-1011:~ norio$ brew install swiftlint
swiftlint: A full installation of Xcode.app 7.0 is required to compile this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: An unsatisfied requirement failed this build.
OS-X-1011:~ norio$ brew install swiftlint -s
swiftlint: A full installation of Xcode.app 7.0 is required to compile this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
swiftlint: A full installation of Xcode.app 8.0 is required to compile this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: Unsatisfied requirements failed this build.
OS-X-1011:~ norio$ sudo xcode-select -s /Volumes/Xcode/Xcode.app/
OS-X-1011:~ norio$ brew install swiftlint -s
Updating Homebrew...
swiftlint: A full installation of Xcode.app 8.0 is required to compile this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: An unsatisfied requirement failed this build.
OS-X-1011:~ norio$ brew install swiftlint
==> Downloading https://homebrew.bintray.com/bottles/swiftlint-0.16.1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring swiftlint-0.16.1.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/swiftlint/0.16.1: 37 files, 13.6M
OS-X-1011:~ norio$ echo "var i = 1"|swiftlint lint --use-stdin
<nopath>:1:1: error: Variable Name Violation: Variable name should be between 3 and 40 characters long: 'i' (variable_name)
Done linting! Found 1 violation, 1 serious in 1 file.
OS-X-1011:~ norio$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment