Skip to content

Commit d18dc3a

Browse files
committed
fix linting errors
1 parent fa9985f commit d18dc3a

File tree

6 files changed

+38
-37
lines changed

6 files changed

+38
-37
lines changed

Sources/Adapters/GCDWebServer/GCDHTTPServer.swift

+9-8
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,20 @@ public class GCDHTTPServer: HTTPServer, Loggable {
163163
}
164164

165165
log(.warning, "Resource not found for request \(request)")
166-
completion(
167-
HTTPServerRequest(url: request.url, href: nil),
168-
FailureResource(link: Link(href: request.url.absoluteString),
169-
error: .notFound(nil)),
170-
nil)
166+
completion(HTTPServerRequest(url: request.url, href: nil),
167+
FailureResource(link: Link(href: request.url.absoluteString),
168+
error: .notFound(nil)),
169+
nil)
171170
}
172171
}
173172

174173
// MARK: HTTPServer
175174

176-
public func serve(at endpoint: HTTPServerEndpoint,
177-
handler: @escaping (HTTPServerRequest) -> Resource,
178-
failureHandler: FailureHandler?) throws -> URL {
175+
public func serve(
176+
at endpoint: HTTPServerEndpoint,
177+
handler: @escaping (HTTPServerRequest) -> Resource,
178+
failureHandler: FailureHandler?
179+
) throws -> URL {
179180
try queue.sync(flags: .barrier) {
180181
if case .stopped = state {
181182
try start()

Sources/Navigator/CBZ/CBZNavigatorViewController.swift

+6-7
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,16 @@ open class CBZNavigatorViewController: UIViewController, VisualNavigator, Loggab
6464
guard let self = self else {
6565
return
6666
}
67-
self.delegate?.navigator(
68-
self,
69-
didFailToLoadResourceAt: request.href,
70-
url: request.url,
71-
withError: error)
67+
self.delegate?.navigator(self,
68+
didFailToLoadResourceAt: request.href,
69+
url: request.url,
70+
withError: error)
7271
}
7372
}
7473
)
7574
}
7675

77-
self.publicationBaseURL = URL(string: publicationBaseURL.absoluteString.addingSuffix("/"))!
76+
publicationBaseURL = URL(string: publicationBaseURL.absoluteString.addingSuffix("/"))!
7877
}
7978

8079
@available(*, deprecated, message: "See the 2.5.0 migration guide to migrate the HTTP server")
@@ -91,7 +90,7 @@ open class CBZNavigatorViewController: UIViewController, VisualNavigator, Loggab
9190
publicationEndpoint: nil
9291
)
9392

94-
self.publicationBaseURL = URL(string: publicationBaseURL.absoluteString.addingSuffix("/"))!
93+
publicationBaseURL = URL(string: publicationBaseURL.absoluteString.addingSuffix("/"))!
9594
}
9695

9796
private init(

Sources/Navigator/EPUB/EPUBNavigatorViewController.swift

+6-4
Original file line numberDiff line numberDiff line change
@@ -945,10 +945,12 @@ extension EPUBNavigatorViewController: EPUBNavigatorViewModelDelegate {
945945
}
946946
}
947947

948-
func epubNavigatorViewModel(_ viewModel: EPUBNavigatorViewModel,
949-
didFailToLoadResourceAt href: String?,
950-
url: URL,
951-
withError error: ResourceError) {
948+
func epubNavigatorViewModel(
949+
_ viewModel: EPUBNavigatorViewModel,
950+
didFailToLoadResourceAt href: String?,
951+
url: URL,
952+
withError error: ResourceError
953+
) {
952954
DispatchQueue.main.async {
953955
self.delegate?.navigator(self,
954956
didFailToLoadResourceAt: href,

Sources/Navigator/EPUB/EPUBNavigatorViewModel.swift

+6-7
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,16 @@ final class EPUBNavigatorViewModel: Loggable {
8080
publicationBaseURL = url
8181
} else {
8282
publicationBaseURL = try httpServer.serve(
83-
at: uuidEndpoint, //serving the chapters endpoint
83+
at: uuidEndpoint, // serving the chapters endpoint
8484
publication: publication,
8585
failureHandler: { [weak self] request, error in
8686
guard let self = self else {
8787
return
8888
}
89-
self.delegate?.epubNavigatorViewModel(
90-
self,
91-
didFailToLoadResourceAt: request.href,
92-
url: request.url,
93-
withError: error)
89+
self.delegate?.epubNavigatorViewModel(self,
90+
didFailToLoadResourceAt: request.href,
91+
url: request.url,
92+
withError: error)
9493
}
9594
)
9695
}
@@ -134,7 +133,7 @@ final class EPUBNavigatorViewModel: Loggable {
134133
useLegacySettings: true
135134
)
136135

137-
self.publicationBaseURL = baseURL
136+
publicationBaseURL = baseURL
138137
}
139138

140139
private init(

Sources/Navigator/PDF/PDFNavigatorViewController.swift

+4-5
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,10 @@ open class PDFNavigatorViewController: UIViewController, VisualNavigator, Select
125125
guard let self = self else {
126126
return
127127
}
128-
self.delegate?.navigator(
129-
self,
130-
didFailToLoadResourceAt: request.href,
131-
url: request.url,
132-
withError: error)
128+
self.delegate?.navigator(self,
129+
didFailToLoadResourceAt: request.href,
130+
url: request.url,
131+
withError: error)
133132
}
134133
}
135134
)

Sources/Shared/Toolkit/HTTP/HTTPServer.swift

+7-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public protocol HTTPServer {
1919
///
2020
/// - Returns the base URL for this endpoint.
2121
@discardableResult
22-
func serve(at endpoint: HTTPServerEndpoint,
22+
func serve(at endpoint: HTTPServerEndpoint,
2323
handler: @escaping (HTTPServerRequest) -> Resource) throws -> URL
2424

2525
/// Serves resources at the given `endpoint`.
@@ -30,7 +30,7 @@ public protocol HTTPServer {
3030
///
3131
/// - Returns the base URL for this endpoint.
3232
@discardableResult
33-
func serve(at endpoint: HTTPServerEndpoint,
33+
func serve(at endpoint: HTTPServerEndpoint,
3434
handler: @escaping (HTTPServerRequest) -> Resource,
3535
failureHandler: FailureHandler?) throws -> URL
3636

@@ -45,8 +45,10 @@ public protocol HTTPServer {
4545

4646
public extension HTTPServer {
4747
@discardableResult
48-
func serve(at endpoint: HTTPServerEndpoint,
49-
handler: @escaping (HTTPServerRequest) -> Resource) throws -> URL {
48+
func serve(
49+
at endpoint: HTTPServerEndpoint,
50+
handler: @escaping (HTTPServerRequest) -> Resource
51+
) throws -> URL {
5052
try serve(at: endpoint, handler: handler, failureHandler: nil)
5153
}
5254

@@ -89,7 +91,7 @@ public extension HTTPServer {
8991
)
9092
}
9193

92-
return try serve(at: endpoint,
94+
return try serve(at: endpoint,
9395
handler: handler(request:),
9496
failureHandler: failureHandler)
9597
}
@@ -125,7 +127,6 @@ public extension HTTPServer {
125127
)
126128
}
127129

128-
129130
return publication.get(href)
130131
}
131132

0 commit comments

Comments
 (0)