长话短说
我试图使用cocoapods将swiftlint添加到我的项目中,但是在添加run脚本之后,我无法毫无错误地执行pod installpod update
每次执行pod install时,我都会得到错误

/Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/sidekick.rb:67:in `url_for_request': uninitialized constant GhInspector::Sidekick::ERB (NameError)
    from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/sidekick.rb:24:in `search'
    from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/inspector.rb:65:in `search_query'
    from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/inspector.rb:59:in `search_exception'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface/error_report.rb:119:in `search_for_exceptions'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:67:in `report_error'
    from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:396:in `handle_exception'
    from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:337:in `rescue in run'
    from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:324:in `run'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:22:in `load'
    from /usr/local/bin/pod:22:in `<main>'

现在完整描述
从使用swiftlint的过程开始,我将它添加到我的podfile中
platform :ios, '10.0'

use_frameworks!

target 'ProjectName' do

pod 'Realm'
pod 'RealmSwift'
pod 'Fabric'
pod 'Crashlytics'
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/AdMob'
pod 'SwiftLint'

end

然后我安装我的豆荚没有任何错误。
在此之后,我添加.swiftlint.yml文件:
disabled_rules: # rule identifiers to exclude from running
 - trailing_whitespace

excluded: # paths to ignore during linting. Takes precedence over `included`.
 - Pods

在这一点上,我仍然能够像一个咒语一样执行pod installpod update,但是swiftlint配置仍然没有完成最后一步。
添加运行脚本后
if which swiftlint >/dev/null; then
    swiftlint
else
    echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

swiftlint开始工作了,但是,正如我在问题开始时所说的,我无法运行pod installpod update
版本数据
Ruby版本:
Ruby 2.5.1P57(2018-03-29修订版63029)[x86_64-darwin18]
可可豆版本:
1.5.3条
迅捷版:
0.27.0分
我能解决这个错误吗?

最佳答案

你的环境看起来不错。
是否创建了另一个运行脚本?
在已经存在的run脚本上放置SWIFFTLT脚本,或者为您创建的每个“运行脚本”赋予不同的名称。

10-08 04:52