Skip to content

Revert "Resolve all current code warnings (#1143)" #1145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ let package = Package(
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
// Building standalone, so fetch all dependencies remotely.
package.dependencies += [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.78.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.53.0"),
.package(url: "https://github.com/apple/swift-markdown.git", branch: "main"),
.package(url: "https://github.com/apple/swift-lmdb.git", branch: "main"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.2"),
Expand Down
10 changes: 3 additions & 7 deletions Sources/SwiftDocC/Indexing/Navigator/NavigatorIndex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,7 @@ extension NavigatorIndex {

/// The data provider.
@available(*, deprecated, message: "This deprecated API will be removed after 6.2 is released")
public var renderNodeProvider: RenderNodeProvider? {
_renderNodeProvider as! RenderNodeProvider?
}
// This property only exist to be able to assign `nil` to `renderNodeProvider` in the new initializer without causing a deprecation warning.
private let _renderNodeProvider: Any?
public let renderNodeProvider: RenderNodeProvider?

/// The documentation archive to build an index from.
public let archiveURL: URL?
Expand Down Expand Up @@ -579,7 +575,7 @@ extension NavigatorIndex {
/// - usePageTitle: Configure the builder to use the "page title" instead of the "navigator title" as the title for each entry.
public init(archiveURL: URL? = nil, outputURL: URL, bundleIdentifier: String, sortRootChildrenByName: Bool = false, groupByLanguage: Bool = false, writePathsOnDisk: Bool = true, usePageTitle: Bool = false) {
self.archiveURL = archiveURL
self._renderNodeProvider = nil
self.renderNodeProvider = nil
self.outputURL = outputURL
self.bundleIdentifier = bundleIdentifier
self.sortRootChildrenByName = sortRootChildrenByName
Expand All @@ -591,7 +587,7 @@ extension NavigatorIndex {
@available(*, deprecated, renamed: "init(archiveURL:outputURL:bundleIdentifier:sortRootChildrenByName:groupByLanguage:writePathsOnDisk:usePageTitle:)", message: "Use 'init(archiveURL:outputURL:bundleIdentifier:sortRootChildrenByName:groupByLanguage:writePathsOnDisk:usePageTitle:)' instead. This deprecated API will be removed after 6.2 is released")
@_disfavoredOverload
public init(renderNodeProvider: RenderNodeProvider? = nil, outputURL: URL, bundleIdentifier: String, sortRootChildrenByName: Bool = false, groupByLanguage: Bool = false, writePathsOnDisk: Bool = true, usePageTitle: Bool = false) {
self._renderNodeProvider = renderNodeProvider
self.renderNodeProvider = renderNodeProvider
self.archiveURL = nil
self.outputURL = outputURL
self.bundleIdentifier = bundleIdentifier
Expand Down
5 changes: 0 additions & 5 deletions Sources/SwiftDocC/Indexing/Navigator/NavigatorTree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,7 @@ public class NavigatorTree {

func __read() {
let deadline = DispatchTime.now() + timeout
#if swift(>=5.10)
// Access to this local variable is synchronized using the DispatchQueue `queue`, passed as an argument.
nonisolated(unsafe) var processedNodes = [NavigatorTree.Node]()
#else
var processedNodes = [NavigatorTree.Node]()
#endif

while readingCursor.cursor < readingCursor.data.count {
let length = MemoryLayout<UInt32>.stride
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public extension XCTestCase {
///
/// - Parameters:
/// - pathComponents: The name of the temporary directory.
/// - fileManager: The file manager that will create the directory.
/// - Returns: The URL of the newly created directory.
func createTemporaryDirectory(named: String) throws -> URL {
func createTemporaryDirectory(named: String, fileManager: FileManager = .default) throws -> URL {
try createTemporaryDirectory(pathComponents: named)
}

Expand All @@ -47,8 +48,9 @@ public extension XCTestCase {
///
/// - Parameters:
/// - pathComponents: Additional path components to add to the temporary URL.
/// - fileManager: The file manager that will create the directory.
/// - Returns: The URL of the newly created directory.
func createTemporaryDirectory(pathComponents: String...) throws -> URL {
func createTemporaryDirectory(pathComponents: String..., fileManager: FileManager = .default) throws -> URL {
let bundleParentDir = Bundle(for: Self.self).bundleURL.deletingLastPathComponent()
let baseURL = bundleParentDir.appendingPathComponent(name.replacingWhitespaceAndPunctuation(with: "-"))

Expand All @@ -60,20 +62,20 @@ public extension XCTestCase {

addTeardownBlock {
do {
if FileManager.default.fileExists(atPath: baseURL.path) {
try FileManager.default.removeItem(at: baseURL)
if fileManager.fileExists(atPath: baseURL.path) {
try fileManager.removeItem(at: baseURL)
}
} catch {
XCTFail("Failed to remove temporary directory: '\(error)'")
}
}

if !FileManager.default.fileExists(atPath: bundleParentDir.path) {
if !fileManager.fileExists(atPath: bundleParentDir.path) {
// Create the base URL directory without intermediate directories so that an error is raised if the parent directory doesn't exist.
try FileManager.default.createDirectory(at: baseURL, withIntermediateDirectories: false, attributes: nil)
try fileManager.createDirectory(at: baseURL, withIntermediateDirectories: false, attributes: nil)
}

try FileManager.default.createDirectory(at: tempURL, withIntermediateDirectories: true, attributes: nil)
try fileManager.createDirectory(at: tempURL, withIntermediateDirectories: true, attributes: nil)

return tempURL
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ final class PreviewHTTPHandler: ChannelInboundHandler {

// If we don't need to keep the connection alive, close `context` after flushing the response
if !self.keepAlive {
promise.futureResult.assumeIsolated().whenComplete { _ in context.close(promise: nil) }
promise.futureResult.whenComplete { _ in context.close(promise: nil) }
}

context.writeAndFlush(self.wrapOutboundOut(.end(trailers)), promise: promise)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class PreviewHTTPHandlerTests: XCTestCase {

let response = Response()

XCTAssertNoThrow(try channel.pipeline.addHandler(HTTPResponseEncoder()).wait())
XCTAssertNoThrow(try channel.pipeline.addHandler(response).wait())
XCTAssertNoThrow(try channel.pipeline.addHandler(channelHandler).wait())
XCTAssertNoThrow(try channel.pipeline.addHandler(HTTPServerPipelineHandler()).wait())

XCTAssertNoThrow(try channel.connect(to: SocketAddress(ipAddress: "127.0.0.1", port: 1)).wait())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ func responseWithPipeline(request: HTTPRequestHead, handler factory: RequestHand

let response = Response()

XCTAssertNoThrow(try channel.pipeline.addHandler(HTTPResponseEncoder()).wait(), file: (file), line: line)
XCTAssertNoThrow(try channel.pipeline.addHandler(response).wait(), file: (file), line: line)
XCTAssertNoThrow(try channel.pipeline.addHandler(channelHandler).wait(), file: (file), line: line)
XCTAssertNoThrow(try channel.pipeline.addHandler(HTTPServerPipelineHandler()).wait(), file: (file), line: line)

XCTAssertNoThrow(try channel.connect(to: SocketAddress(ipAddress: "127.0.0.1", port: 1)).wait(), file: (file), line: line)

Expand Down
2 changes: 1 addition & 1 deletion bin/check-source
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ for language in swift-or-c bash md-or-tutorial html docker; do
declare -a matching_files
declare -a exceptions
declare -a reader
expections=( )
matching_files=( -name '*' )
reader=head
case "$language" in
Expand Down Expand Up @@ -135,7 +136,6 @@ EOF
cd "$here/.."
find . \
\( \! -path './.build/*' -a \
\! -path './bin/benchmark/.build/*' -a \
\! -name '.' -a \
\( "${matching_files[@]}" \) -a \
\( \! \( "${exceptions[@]}" \) \) \) | while read line; do
Expand Down