非法指令:4 "${PODS_ROOT}/SwiftLint/swiftlint"

Illegal instruction: 4 "${PODS_ROOT}/SwiftLint/swiftlint"

将 SwiftLint 0.16.1 更新为 SwiftLint 0.18.1 时,我得到:

/Users/coeur/Library/Developer/Xcode/DerivedData/MyApp-7-eloayqptodupvfhbyegtkncnhcpu/Build/Intermediates/MyApp-7.build/UAT-iphonesimulator/MyApp-7-Debug.build/Script-379156A71D62F5C100574D04.sh: line 2: 30296 Illegal instruction: 4 "${PODS_ROOT}/SwiftLint/swiftlint" Command /bin/sh failed with exit code 132

DerivedData 是干净的。
使用 Xcode 8.3.1、CocoaPods 1.2.1、Swift 3.1.

我的.swiftlint.yml:

# Find all the available rules by running:
# swiftlint rules

excluded:
- Carthage
- Pods

disabled_rules:
  - todo
  - line_length

opt_in_rules:
  - empty_count

trailing_whitespace:
 ignores_empty_lines: true
 ignores_comments: true
large_tuple: warning: 3
type_name: max_length: warning: 42
variable_name: min_length: warning: 1

SwiftLint 0.18.x 引入了重大更改。他们将 YamlSwift 替换为 Yams。 Yams 比 YamlSwift 更严格地解释 YAML,因此如果您的 .swiftlint.yml 配置以前使用 SwiftLint 但不完全符合 YAML 1.2 standard,您将需要修复这些验证错误。

在你(我)的情况下,每个映射条目(用冒号 : 表示)需要独占一行:

large_tuple:
 warning: 3
type_name:
 max_length:
  warning: 42
variable_name:
 min_length:
  warning: 1

请注意,已发出拉取请求以避免将来因此问题导致 SwiftLint 崩溃:https://github.com/jpsim/Yams/pull/37