Skip to content

Commit ce2abfd

Browse files
committed
Lint
1 parent 6d44cd5 commit ce2abfd

File tree

5 files changed

+10
-44
lines changed

5 files changed

+10
-44
lines changed

Sources/Shared/Toolkit/ZIP/ZIPFoundation.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import ReadiumZIPFoundation
99

1010
/// An ``ArchiveOpener`` able to open ZIP archives using ZIPFoundation.
1111
public final class ZIPFoundationArchiveOpener: ArchiveOpener {
12-
1312
public init() {}
14-
13+
1514
public func open(resource: any Resource, format: Format) async -> Result<ContainerAsset, ArchiveOpenError> {
1615
guard
1716
format.conformsTo(.zip),
@@ -152,14 +151,13 @@ private actor ZIPFoundationResource: Resource, Loggable {
152151
}
153152

154153
func stream(range: Range<UInt64>?, consume: @escaping (Data) -> Void) async -> ReadResult<Void> {
155-
if range != nil {
156-
}
154+
if range != nil {}
157155

158156
return await archive().flatMap { archive in
159157
guard let entry = archive[entryPath] else {
160158
return .failure(.decoding("No entry found in the ZIP at \(entryPath)"))
161159
}
162-
160+
163161
do {
164162
if let range = range {
165163
try archive.extractRange(range, of: entry) { data in
@@ -176,12 +174,12 @@ private actor ZIPFoundationResource: Resource, Loggable {
176174
}
177175
}
178176
}
179-
177+
180178
private var _archive: ReadResult<ReadiumZIPFoundation.Archive>?
181179
private func archive() async -> ReadResult<ReadiumZIPFoundation.Archive> {
182180
if _archive == nil {
183181
do {
184-
_archive = .success(try ReadiumZIPFoundation.Archive(url: file.url, accessMode: .read, pathEncoding: nil))
182+
_archive = try .success(ReadiumZIPFoundation.Archive(url: file.url, accessMode: .read))
185183
} catch {
186184
_archive = .failure(.decoding(error))
187185
}

TestApp/Sources/App/Readium.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import Foundation
88
import ReadiumAdapterGCDWebServer
9-
import ReadiumAdapterZIPFoundation
109
import ReadiumNavigator
1110
import ReadiumShared
1211
import ReadiumStreamer

Tests/Adapters/ZIPFoundationTests/Fixtures

Lines changed: 0 additions & 1 deletion
This file was deleted.

Tests/Adapters/ZIPFoundationTests/Fixtures.swift

Lines changed: 0 additions & 29 deletions
This file was deleted.

Tests/SharedTests/Toolkit/Archive/ZIPFoundationTests.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import XCTest
1010
private let fixtures = Fixtures(path: "Archive")
1111

1212
class ZIPFoundationTests: XCTestCase {
13-
1413
private func container(for filename: String) async throws -> Container {
1514
try await ZIPFoundationContainer.make(file: fixtures.url(for: filename)).get()
1615
}
17-
16+
1817
func testOpenSuccess() async throws {
1918
_ = try await container(for: "test.zip")
2019
}
@@ -107,9 +106,9 @@ class ZIPFoundationTests: XCTestCase {
107106
" ZIP.\n"
108107
)
109108
}
110-
109+
111110
func testRandomCompressedRead() async throws {
112-
for _ in 0..<100 {
111+
for _ in 0 ..< 100 {
113112
let container = try await container(for: "test.zip")
114113
let entry = try XCTUnwrap(container[AnyURL(path: "A folder/wasteland-cover.jpg")!])
115114
let length: UInt64 = 103_477
@@ -119,9 +118,9 @@ class ZIPFoundationTests: XCTestCase {
119118
_ = try await entry.read(range: range).get()
120119
}
121120
}
122-
121+
123122
func testRandomStoredRead() async throws {
124-
for _ in 0..<100 {
123+
for _ in 0 ..< 100 {
125124
let container = try await container(for: "test.zip")
126125
let entry = try XCTUnwrap(container[AnyURL(path: "uncompressed.jpg")!])
127126
let length: UInt64 = 279_551

0 commit comments

Comments
 (0)