mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
ea171fbbf2
This can be used for avoid "Test::Unit::AssertionFailedError" error in `libxpc.dylib` on calling `sourcekitd_send_request_sync` in sandbox environment.
14 lines
455 B
Swift
14 lines
455 B
Swift
import Foundation
|
|
import SourceKittenFramework
|
|
|
|
extension Request {
|
|
static let disableSourceKit = ProcessInfo.processInfo.environment["SWIFTLINT_DISABLE_SOURCEKIT"] != nil
|
|
|
|
func sendIfNotDisabled() throws -> [String: SourceKitRepresentable] {
|
|
guard !Request.disableSourceKit else {
|
|
throw Request.Error.connectionInterrupted("SourceKit is disabled by `SWIFTLINT_DISABLE_SOURCEKIT`.")
|
|
}
|
|
return try send()
|
|
}
|
|
}
|