Merge pull request #2042 from ahoppen/soundness-checks

Fix yaml lint error and remove offensive terms from the codebase
This commit is contained in:
Alex Hoppen
2025-03-08 03:53:50 -08:00
committed by GitHub
12 changed files with 32 additions and 32 deletions

View File

@@ -1,12 +1,12 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2024 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
#
# Copyright (c) 2024 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
contact_links:
- name: Discussion Forum
url: https://forums.swift.org/c/development/sourcekit-lsp
about: Ask and answer questions about SourceKit-LSP
contact_links:
- name: Discussion Forum
url: https://forums.swift.org/c/development/sourcekit-lsp
about: Ask and answer questions about SourceKit-LSP

View File

@@ -38,7 +38,7 @@ The structure of the file is currently not guaranteed to be stable. Options may
- `clangdOptions: string[]`: Extra command line arguments passed to `clangd` when launching it.
- `index`: Options related to indexing.
- `indexPrefixMap: [string: string]`: Path remappings for remapping index data for local use.
- `updateIndexStoreTimeout: integer`: Number of seconds to wait for an update index store task to finish before killing it.
- `updateIndexStoreTimeout: integer`: Number of seconds to wait for an update index store task to finish before terminating it.
- `logging`: Options related to logging, changing SourceKit-LSPs logging behavior on non-Apple platforms. On Apple platforms, logging is done through the [system log](Diagnose%20Bundle.md#Enable%20Extended%20Logging). These options can only be set globally and not per workspace.
- `level: "debug"|"info"|"default"|"error"|"fault"`: The level from which one onwards log messages should be written.
- `privacyLevel: "public"|"private"|"sensitive"`: Whether potentially sensitive information should be redacted. Default is `public`, which redacts potentially sensitive information.

View File

@@ -42,7 +42,7 @@ public struct OptionalVersionedTextDocumentIdentifier: Hashable, Codable, Sendab
/// identifier is sent from the server to the client and the file is not
/// open in the editor (the server has not received an open notification
/// before) the server can send `null` to indicate that the version is
/// known and the content on disk is the master (as specified with document
/// known and the content on disk is the primary (as specified with document
/// content ownership).
///
/// The version number of a document will increase after each change,

View File

@@ -144,7 +144,7 @@ private func isProcessAlive(pid: Int32) -> Bool {
}
return false
#else
return kill(pid, 0) == 0
return kill(pid, 0) == 0 // ignore-unacceptable-language
#endif
}

View File

@@ -179,7 +179,7 @@ public struct SourceKitLSPOptions: Sendable, Codable, Equatable {
///
/// - Note: Internal option, may not work as intended
public var maxCoresPercentageToUseForBackgroundIndexing: Double?
/// Number of seconds to wait for an update index store task to finish before killing it.
/// Number of seconds to wait for an update index store task to finish before terminating it.
public var updateIndexStoreTimeout: Int?
public var maxCoresPercentageToUseForBackgroundIndexingOrDefault: Double {

View File

@@ -318,19 +318,19 @@ actor ClangLanguageService: LanguageService, MessageHandler {
}
func crash() {
// Since `clangd` doesn't have a method to crash it, kill it.
// Since `clangd` doesn't have a method to crash it, terminate it.
#if os(Windows)
if self.hClangd != INVALID_HANDLE_VALUE {
// We can potentially deadlock the process if a kobject is a pending state.
// Unfortunately, the `OpenProcess(PROCESS_TERMINATE, ...)`, `CreateRemoteThread`, `ExitProcess` dance, while
// safer, can also indefinitely hang as `CreateRemoteThread` may not be serviced depending on the state of
// safer, can also indefinitely spin as `CreateRemoteThread` may not be serviced depending on the state of
// the process. This just attempts to terminate the process, risking a deadlock and resource leaks, which is fine
// since we only use `crash` from tests.
_ = TerminateProcess(self.hClangd, 255)
}
#else
if let pid = self.clangdPid {
kill(pid, SIGKILL)
kill(pid, SIGKILL) // ignore-unacceptable-language
}
#endif
}

View File

@@ -51,7 +51,7 @@ fileprivate extension Range {
}
}
/// Explicitly blacklisted `DocumentURI` schemes.
/// Explicitly excluded `DocumentURI` schemes.
fileprivate let excludedDocumentURISchemes: [String] = [
"git",
"hg",
@@ -59,9 +59,9 @@ fileprivate let excludedDocumentURISchemes: [String] = [
/// Returns true if diagnostics should be emitted for the given document.
///
/// Some editors (like Visual Studio Code) use non-file URLs to manage source control diff bases
/// Some editors (like Visual Studio Code) use non-file URLs to manage source control diff bases
/// for the active document, which can lead to duplicate diagnostics in the Problems view.
/// As a workaround we explicitly blacklist those URIs and don't emit diagnostics for them.
/// As a workaround we explicitly exclude those URIs and don't emit diagnostics for them.
///
/// Additionally, as of Xcode 11.4, sourcekitd does not properly handle non-file URLs when
/// the `-working-directory` argument is passed since it incorrectly applies it to the input

View File

@@ -28,7 +28,7 @@ import Android
extension Process {
/// Wait for the process to exit. If the task gets cancelled, during this time, send a `SIGINT` to the process.
/// Should the process not terminate on SIGINT after 2 seconds, it is killed using `SIGKILL`.
/// Should the process not terminate on SIGINT after 2 seconds, it is terminated using `SIGKILL`.
@discardableResult
package func waitUntilExitStoppingProcessOnTaskCancellation() async throws -> ProcessResult {
let hasExited = AtomicBool(initialValue: false)
@@ -40,7 +40,7 @@ extension Process {
} onCancel: {
signal(SIGINT)
Task {
// Give the process 2 seconds to react to a SIGINT. If that doesn't work, kill the process.
// Give the process 2 seconds to react to a SIGINT. If that doesn't work, terminate the process.
try await Task.sleep(for: .seconds(2))
if !hasExited.value {
#if os(Windows)

View File

@@ -63,13 +63,13 @@ final class CrashRecoveryTests: XCTestCase {
// Wait for diagnostics to be produced to make sure the document open got handled by sourcekitd.
_ = try await testClient.nextDiagnosticsNotification()
// Do a sanity check and verify that we get the expected result from a hover response before crashing sourcekitd.
// Verify that we get the expected result from a hover response before crashing sourcekitd.
let hoverRequest = HoverRequest(textDocument: TextDocumentIdentifier(uri), position: positions["1"])
let preCrashHoverResponse = try await testClient.send(hoverRequest)
precondition(
preCrashHoverResponse?.contains(string: "foo()") ?? false,
"Sanity check failed. The Hover response did not contain foo(), even before crashing sourcekitd. Received response: \(String(describing: preCrashHoverResponse))"
"Precondition test failed. The Hover response did not contain foo(), even before crashing sourcekitd. Received response: \(String(describing: preCrashHoverResponse))"
)
testClient.handleSingleRequest { (request: CreateWorkDoneProgressRequest) -> VoidResponse in
@@ -170,7 +170,7 @@ final class CrashRecoveryTests: XCTestCase {
)
)
// Do a sanity check and verify that we get the expected result from a hover response before crashing clangd.
// Verify that we get the expected result from a hover response before crashing clangd.
let expectedHoverRange = Position(line: 1, utf16index: 5)..<Position(line: 1, utf16index: 9)
@@ -181,7 +181,7 @@ final class CrashRecoveryTests: XCTestCase {
let preCrashHoverResponse = try await testClient.send(hoverRequest)
precondition(
preCrashHoverResponse?.range == expectedHoverRange,
"Sanity check failed. The Hover response was not what we expected, even before crashing sourcekitd"
"Precondition test failed. The Hover response was not what we expected, even before crashing sourcekitd"
)
// Crash clangd
@@ -218,7 +218,7 @@ final class CrashRecoveryTests: XCTestCase {
let (mainUri, positions) = try project.openDocument("main.cpp")
// Do a sanity check and verify that we get the expected result from a hover response before crashing clangd.
// Verify that we get the expected result from a hover response before crashing clangd.
let expectedHighlightResponse = [
DocumentHighlight(range: positions["1"]..<positions["2"], kind: .text),
@@ -232,7 +232,7 @@ final class CrashRecoveryTests: XCTestCase {
let preCrashHighlightResponse = try await project.testClient.send(highlightRequest)
precondition(
preCrashHighlightResponse == expectedHighlightResponse,
"Sanity check failed. The Hover response was not what we expected, even before crashing sourcekitd"
"Precondition test failed. The Hover response was not what we expected, even before crashing sourcekitd"
)
// Crash clangd

View File

@@ -39,7 +39,7 @@ final class CompilationDatabaseTests: XCTestCase {
let (mainUri, positions) = try project.openDocument("main.cpp")
// Do a sanity check and verify that we get the expected result from a hover response before modifying the compile commands.
// Verify that we get the expected result from a hover response before modifying the compile commands.
let highlightRequest = DocumentHighlightRequest(
textDocument: TextDocumentIdentifier(mainUri),

View File

@@ -35,7 +35,7 @@ final class SwiftInterfaceTests: XCTestCase {
let location = try XCTUnwrap(resp?.locations?.only)
XCTAssertTrue(location.uri.pseudoPath.hasSuffix("Foundation.swiftinterface"))
let fileContents = try XCTUnwrap(location.uri.fileURL.flatMap({ try String(contentsOf: $0, encoding: .utf8) }))
// Sanity-check that the generated Swift Interface contains Swift code
// Smoke test that the generated Swift Interface contains Swift code
XCTAssert(
fileContents.hasPrefix("import "),
"Expected that the foundation swift interface starts with 'import ' but got '\(fileContents.prefix(100))'"

View File

@@ -143,8 +143,8 @@
"type" : "object"
},
"updateIndexStoreTimeout" : {
"description" : "Number of seconds to wait for an update index store task to finish before killing it.",
"markdownDescription" : "Number of seconds to wait for an update index store task to finish before killing it.",
"description" : "Number of seconds to wait for an update index store task to finish before terminating it.",
"markdownDescription" : "Number of seconds to wait for an update index store task to finish before terminating it.",
"type" : "integer"
}
},