1

Long story short

I'm trying to add SwiftLint into my project using cocoapods, but after I add the run script, I'm unable to perform pod install and pod update without error.

Every time that I execute pod install I get the error

/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>'

Full description now

Start from the beginning of the process to use SwiftLint, I'm add it to my 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

Then I install my pods without any error.

After this I add the .swiftlint.yml file with:

disabled_rules: # rule identifiers to exclude from running
 - trailing_whitespace

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

At this point I'm still able to execute pod install and pod update like a charm, but SwiftLint configuration still miss one last step to work.

After I add the run script

if which swiftlint >/dev/null; then
    swiftlint
else
    echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

SwiftLint start to work, but, as I said at the beginning of the question, I'm unable to run pod install and pod update

Versions data

ruby version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin18]

cocoapods version: 1.5.3

SwiftLint version: 0.27.0

Any idea of how can I solve this error?

FilipeFaria
  • 639
  • 1
  • 10
  • 16
  • You are probably installing the latest version which needs a higher ruby version that you have. Can you provide your version for ruby, cocoapods, swiftlint – Scriptable Sep 26 '18 at 14:29
  • I added the versions on the question, I will check the compatibility right now. thanks! – FilipeFaria Sep 26 '18 at 15:59

2 Answers2

2

Your environment seems ok. Did you create another run script? Put the swiftlint script on run script that already exists, or give a different name for every "Run Script" you create.

  • You were right, I added the run script to the same run script of Fabric and the `pod install` started to work again! thanks a lot! – FilipeFaria Sep 26 '18 at 17:18
0

"${PODS_ROOT}/SwiftLint/swiftlint"

Updated your run script to this

Sumit
  • 874
  • 9
  • 10