2018-01-22 20:01:53 +00:00
|
|
|
#!/bin/bash
|
2019-12-19 17:32:49 +00:00
|
|
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
|
#
|
|
|
|
|
# This source code is licensed under the MIT license found in the
|
|
|
|
|
# LICENSE file in the root directory of this source tree.
|
2018-01-22 20:01:53 +00:00
|
|
|
|
2021-08-19 16:57:26 +00:00
|
|
|
# Adds support for Apple Silicon brew directory
|
|
|
|
|
if test -d "/opt/homebrew/bin/"; then
|
|
|
|
|
PATH="/opt/homebrew/bin/:${PATH}"
|
|
|
|
|
export PATH
|
|
|
|
|
fi
|
|
|
|
|
|
2018-01-22 20:01:53 +00:00
|
|
|
VERSION="0.24.2"
|
2018-02-02 21:14:16 +00:00
|
|
|
FOUND=$(swiftlint version)
|
2018-01-22 20:01:53 +00:00
|
|
|
|
2018-02-02 21:14:16 +00:00
|
|
|
if which swiftlint >/dev/null; then
|
2017-07-12 19:14:58 +00:00
|
|
|
swiftlint lint --config ../.swiftlint.yml
|
|
|
|
|
else
|
2018-01-22 20:01:53 +00:00
|
|
|
echo "
|
2018-02-02 21:14:16 +00:00
|
|
|
Error: SwiftLint not installed!
|
2018-01-22 20:01:53 +00:00
|
|
|
Download from https://github.com/realm/SwiftLint,
|
2018-02-02 21:14:16 +00:00
|
|
|
or brew install swiftlint.
|
2018-01-22 20:01:53 +00:00
|
|
|
"
|
|
|
|
|
exit 1
|
2017-07-12 19:14:58 +00:00
|
|
|
fi
|
2018-02-02 21:14:16 +00:00
|
|
|
|
|
|
|
|
if [ $(swiftlint version) != $VERSION ]; then
|
|
|
|
|
echo "
|
|
|
|
|
Warning: incorrect SwiftLint installed!
|
|
|
|
|
Expected: $VERSION
|
|
|
|
|
Found: $FOUND
|
|
|
|
|
Download from https://github.com/realm/SwiftLint,
|
|
|
|
|
or brew upgrade swiftlint.
|
|
|
|
|
"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
exit
|