Skip to content

Commit 9aded4c

Browse files
chore: swift-format
1 parent a4f7ea4 commit 9aded4c

File tree

8 files changed

+36
-20
lines changed

8 files changed

+36
-20
lines changed

Sources/GraphQL/Error/GraphQLError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public struct GraphQLError: Error, Codable {
3838
* Appears in the result of `description`.
3939
*/
4040
public let path: IndexPath
41-
41+
4242
/// Reserved for implementors to add additional information to errors
4343
/// however they see fit, and there are no restrictions on its contents.
4444
///
@@ -144,7 +144,7 @@ public struct GraphQLError: Error, Codable {
144144
}
145145

146146
try container.encode(path, forKey: .path)
147-
147+
148148
if !extensions.isEmpty {
149149
try container.encode(extensions, forKey: .extensions)
150150
}

Sources/GraphQL/Execution/Values.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func coerceValue(value: Map, type: GraphQLInputType) throws -> Map {
149149
}
150150

151151
// Convert solitary value into single-value array
152-
return .array([try coerceValue(value: value, type: itemType)])
152+
return try .array([coerceValue(value: value, type: itemType)])
153153
}
154154

155155
if let objectType = type as? GraphQLInputObjectType {

Sources/GraphQL/Language/Parser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ func many<T>(
13311331
parse: (Lexer) throws -> T
13321332
) throws -> [T] {
13331333
try expect(lexer: lexer, kind: openKind)
1334-
var nodes = [try parse(lexer)]
1334+
var nodes = try [parse(lexer)]
13351335
while try !skip(lexer: lexer, kind: closeKind) {
13361336
try nodes.append(parse(lexer))
13371337
}

Sources/GraphQL/Map/Map.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,16 +701,16 @@ extension Map: Codable {
701701

702702
/// A wrapper for dictionary keys which are Strings or Ints.
703703
/// This is copied from Swift core: https://github.com/apple/swift/blob/256a9c5ad96378daa03fa2d5197b4201bf16db27/stdlib/public/core/Codable.swift#L5508
704-
internal struct _DictionaryCodingKey: CodingKey {
705-
internal let stringValue: String
706-
internal let intValue: Int?
704+
struct _DictionaryCodingKey: CodingKey {
705+
let stringValue: String
706+
let intValue: Int?
707707

708-
internal init?(stringValue: String) {
708+
init?(stringValue: String) {
709709
self.stringValue = stringValue
710710
intValue = Int(stringValue)
711711
}
712712

713-
internal init?(intValue: Int) {
713+
init?(intValue: Int) {
714714
stringValue = "\(intValue)"
715715
self.intValue = intValue
716716
}

Sources/GraphQL/Utilities/NIO+Extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// DictionaryFuture.swift
2+
// NIO+Extensions.swift
33
// GraphQL
44
//
55
// Created by Jeff Seibert on 3/9/18.

Sources/GraphQL/Utilities/ValueFromAST.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func valueFromAST(
6565
}
6666

6767
// Convert solitary value into single-value array
68-
return .array([
69-
try valueFromAST(
68+
return try .array([
69+
valueFromAST(
7070
valueAST: valueAST,
7171
type: itemType,
7272
variables: variables

Tests/GraphQLTests/LanguageTests/ParserTests.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ class ParserTests: XCTestCase {
2626
XCTAssertEqual(error.locations[0].column, 2)
2727
}
2828

29-
XCTAssertThrowsError(try parse(source: "{ ...MissingOn }\nfragment MissingOn Type\n")) { error in
29+
XCTAssertThrowsError(try parse(
30+
source: "{ ...MissingOn }\nfragment MissingOn Type\n"
31+
)) { error in
3032
guard let error = error as? GraphQLError else {
3133
return XCTFail()
3234
}
@@ -111,7 +113,9 @@ class ParserTests: XCTestCase {
111113
))
112114
}
113115

114-
XCTAssertThrowsError(try parse(source: "type WithImplementsButNoTypes implements {}")) { error in
116+
XCTAssertThrowsError(try parse(
117+
source: "type WithImplementsButNoTypes implements {}"
118+
)) { error in
115119
guard let error = error as? GraphQLError else {
116120
return XCTFail()
117121
}

Tests/GraphQLTests/SubscriptionTests/SubscriptionTests.swift

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ import XCTest
8787
type: GraphQLInt
8888
),
8989
],
90-
resolve: { emailAny, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
90+
resolve: { emailAny, _, _, eventLoopGroup, _ throws -> EventLoopFuture<
91+
Any?
92+
> in
9193
guard let email = emailAny as? Email else {
9294
throw GraphQLError(
9395
message: "Source is not Email type: \(type(of: emailAny))"
@@ -98,7 +100,9 @@ import XCTest
98100
inbox: Inbox(emails: db.emails)
99101
))
100102
},
101-
subscribe: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
103+
subscribe: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<
104+
Any?
105+
> in
102106
eventLoopGroup.next().makeSucceededFuture(db.publisher.subscribe())
103107
}
104108
),
@@ -109,7 +113,9 @@ import XCTest
109113
type: GraphQLInt
110114
),
111115
],
112-
resolve: { emailAny, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
116+
resolve: { emailAny, _, _, eventLoopGroup, _ throws -> EventLoopFuture<
117+
Any?
118+
> in
113119
guard let email = emailAny as? Email else {
114120
throw GraphQLError(
115121
message: "Source is not Email type: \(type(of: emailAny))"
@@ -120,7 +126,9 @@ import XCTest
120126
inbox: Inbox(emails: db.emails)
121127
))
122128
},
123-
subscribe: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
129+
subscribe: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<
130+
Any?
131+
> in
124132
eventLoopGroup.next().makeSucceededFuture(db.publisher.subscribe())
125133
}
126134
),
@@ -192,7 +200,9 @@ import XCTest
192200
resolve: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
193201
eventLoopGroup.next().makeSucceededFuture(nil)
194202
},
195-
subscribe: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
203+
subscribe: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<
204+
Any?
205+
> in
196206
didResolveImportantEmail = true
197207
return eventLoopGroup.next()
198208
.makeSucceededFuture(db.publisher.subscribe())
@@ -203,7 +213,9 @@ import XCTest
203213
resolve: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
204214
eventLoopGroup.next().makeSucceededFuture(nil)
205215
},
206-
subscribe: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<Any?> in
216+
subscribe: { _, _, _, eventLoopGroup, _ throws -> EventLoopFuture<
217+
Any?
218+
> in
207219
didResolveNonImportantEmail = true
208220
return eventLoopGroup.next()
209221
.makeSucceededFuture(db.publisher.subscribe())

0 commit comments

Comments
 (0)