Opaque error message when xcodebuild is unavailable
Open
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
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
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 versionto 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
- Are you using nested configurations?
If so, paste their relative paths and respective contents.
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 useswiftlint lint --path [file here] --no-cache --enable-all-rules.
No
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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