mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
89ebac11d5
* Fix analyzer rules with Xcode 13.3 Looks like starting with Xcode 13.3 / Swift 5.6, cursor info requests started canceling in-flight requests, so we need to pass `key.cancel_on_subsequent_request: false` to bypass that. Analyzer rules on Swift 5.6 are extremely slow, however. Not really usable right now. * Run analyzer rules one file at a time * Add changelog entry
26 lines
906 B
Swift
26 lines
906 B
Swift
import Foundation
|
|
import SourceKittenFramework
|
|
|
|
extension Request {
|
|
static let disableSourceKit = ProcessInfo.processInfo.environment["SWIFTLINT_DISABLE_SOURCEKIT"] != nil
|
|
|
|
func sendIfNotDisabled() throws -> [String: SourceKitRepresentable] {
|
|
guard !Self.disableSourceKit else {
|
|
throw Self.Error.connectionInterrupted("SourceKit is disabled by `SWIFTLINT_DISABLE_SOURCEKIT`.")
|
|
}
|
|
return try send()
|
|
}
|
|
|
|
static func cursorInfo(file: String, offset: ByteCount, arguments: [String]) -> Request {
|
|
.customRequest(request: [
|
|
"key.request": UID("source.request.cursorinfo"),
|
|
"key.name": file,
|
|
"key.sourcefile": file,
|
|
"key.offset": Int64(offset.value),
|
|
"key.compilerargs": arguments,
|
|
"key.cancel_on_subsequent_request": 0,
|
|
"key.retrieve_symbol_graph": 0
|
|
])
|
|
}
|
|
}
|