realm / realm/SwiftLint

Opaque error message when xcodebuild is unavailable

Open
#3,565 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
Describe the bug

If xcodebuild -version returns

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

swiftlint fails with

$ swiftlint lint
Fatal error: Loading sourcekitd.framework/Versions/A/sourcekitd failed: file SourceKittenFramework/library_wrapper.swift, line 31
[1]    83461 trace trap  swiftlint lint

Could we add some kind of detection for this condition and emit a more useful error message?

Complete output when running SwiftLint, including the stack trace and command used

Crash report:
swiftlint_2021-03-10-100023_H2WF637UQ6NY.crash.zip

Environment
  • SwiftLint version (run swiftlint version to be sure)? 0.43.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
  • Paste your configuration file:

See https://github.com/mapbox/mapbox-maps-ios/tree/412981f0712d5f76d6ce41015d21e9fdb9cdb521

Yes:

$ find . -name ".swiftlint.yml" 
./.swiftlint.yml
./Tests/.swiftlint.yml
./Sources/.swiftlint.yml
  • Which Xcode version are you using (check xcodebuild -version)?
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the swiftlint lint command and SourceKittenFramework/library_wrapper.swift, using the reported xcodebuild -version failure as the reproduction case. Add detection for the unavailable Xcode condition and verify that SwiftLint emits a useful error instead of the reported crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.