Skip to content

Commit 1f34b47

Browse files
chore: new swiftformat application
Also removes files that are mostly copied code from formatting
1 parent c275f65 commit 1f34b47

File tree

22 files changed

+188
-84
lines changed

22 files changed

+188
-84
lines changed

Sources/GraphQL/GraphQL.swift

Lines changed: 104 additions & 46 deletions
Large diffs are not rendered by default.

Sources/GraphQL/GraphQLRequest.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public struct GraphQLRequest: Equatable, Codable {
2424
/// This operation performs an entire AST parse on the GraphQL request, so consider
2525
/// performance when calling multiple times.
2626
///
27-
/// - Returns: True if request is a subscription, false if it is an atomic operation (like `query` or `mutation`)
27+
/// - Returns: True if request is a subscription, false if it is an atomic operation (like
28+
/// `query` or `mutation`)
2829
public func isSubscription() throws -> Bool {
2930
let documentAST = try GraphQL.parse(
3031
instrumentation: NoOpInstrumentation,

Sources/GraphQL/Instrumentation/DispatchQueueInstrumentationWrapper.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import NIO
44
/// Proxies calls through to another `Instrumentation` instance via a DispatchQueue
55
///
66
/// Has two primary use cases:
7-
/// 1. Allows a non thread safe Instrumentation implementation to be used along side a multithreaded execution strategy
8-
/// 2. Allows slow or heavy instrumentation processing to happen outside of the current query execution
7+
/// 1. Allows a non thread safe Instrumentation implementation to be used along side a multithreaded
8+
/// execution strategy
9+
/// 2. Allows slow or heavy instrumentation processing to happen outside of the current query
10+
/// execution
911
public class DispatchQueueInstrumentationWrapper: Instrumentation {
1012
let instrumentation: Instrumentation
1113
let dispatchQueue: DispatchQueue

Sources/GraphQL/Language/Parser.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,11 @@ func parseExtensionDefinition(lexer: Lexer) throws -> TypeSystemDefinition {
10081008
case "type": return try parseTypeExtensionDefinition(lexer: lexer)
10091009
case "schema": return try parseSchemaExtensionDefinition(lexer: lexer)
10101010
default:
1011-
throw syntaxError(source: lexer.source, position: token.start, description: "expected schema or type after extend")
1011+
throw syntaxError(
1012+
source: lexer.source,
1013+
position: token.start,
1014+
description: "expected schema or type after extend"
1015+
)
10121016
}
10131017
}
10141018

@@ -1041,7 +1045,8 @@ func parseSchemaExtensionDefinition(lexer: Lexer) throws -> SchemaExtensionDefin
10411045
description: description,
10421046
directives: directives,
10431047
operationTypes: []
1044-
))
1048+
)
1049+
)
10451050
}
10461051

10471052
/**

Sources/GraphQL/Language/Visitor.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ public enum VisitResult {
337337
/// A visitor is provided to visit, it contains the collection of
338338
/// relevant functions to be called during the visitor's traversal.
339339
public struct Visitor {
340-
/// A visitor is comprised of visit functions, which are called on each node during the visitor's traversal.
340+
/// A visitor is comprised of visit functions, which are called on each node during the
341+
/// visitor's traversal.
341342
public typealias Visit = (
342343
Node,
343344
IndexPathElement?,

Sources/GraphQL/Map/AnyCoder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// swiftformat:disable all
12
import CoreFoundation
23
import Foundation
34

Sources/GraphQL/Map/GraphQLJSONEncoder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// swiftformat:disable all
12
import Foundation
23
import OrderedCollections
34

Sources/GraphQL/Map/Map.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,8 @@ extension Map: Codable {
634634
self = .array(array)
635635
} else if let _ = try? container.decode([String: Map].self) {
636636
// Override OrderedDictionary default (unkeyed alternating key-value)
637-
// Instead decode as a keyed container (like normal Dictionary) but use the order of the input
637+
// Instead decode as a keyed container (like normal Dictionary) but use the order of the
638+
// input
638639
let container = try decoder.container(keyedBy: _DictionaryCodingKey.self)
639640
var orderedDictionary: OrderedDictionary<String, Map> = [:]
640641
for key in container.allKeys {
@@ -676,8 +677,10 @@ extension Map: Codable {
676677
try container.encode(array)
677678
case let .dictionary(dictionary):
678679
// Override OrderedDictionary default (unkeyed alternating key-value)
679-
// Instead decode as a keyed container (like normal Dictionary) in the order of our OrderedDictionary
680-
// Note that `JSONEncoder` will ignore this because it uses `Dictionary` underneath. Instead, use `GraphQLJSONEncoder`.
680+
// Instead decode as a keyed container (like normal Dictionary) in the order of our
681+
// OrderedDictionary
682+
// Note that `JSONEncoder` will ignore this because it uses `Dictionary` underneath.
683+
// Instead, use `GraphQLJSONEncoder`.
681684
var container = encoder.container(keyedBy: _DictionaryCodingKey.self)
682685
for (key, value) in dictionary {
683686
if !value.isUndefined {

Sources/GraphQL/Map/MapCoder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// swiftformat:disable all
12
import CoreFoundation
23
import Foundation
34
import OrderedCollections

Sources/GraphQL/Subscription/EventStream.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/// Abstract event stream class - Should be overridden for actual implementations
22
open class EventStream<Element> {
33
public init() {}
4-
/// Template method for mapping an event stream to a new generic type - MUST be overridden by implementing types.
4+
/// Template method for mapping an event stream to a new generic type - MUST be overridden by
5+
/// implementing types.
56
open func map<To>(_: @escaping (Element) throws -> To) -> EventStream<To> {
67
fatalError("This function should be overridden by implementing classes")
78
}
@@ -18,7 +19,8 @@ open class EventStream<Element> {
1819
self.stream = stream
1920
}
2021

21-
/// Performs the closure on each event in the current stream and returns a stream of the results.
22+
/// Performs the closure on each event in the current stream and returns a stream of the
23+
/// results.
2224
/// - Parameter closure: The closure to apply to each event in the stream
2325
/// - Returns: A stream of the results
2426
override open func map<To>(_ closure: @escaping (Element) throws -> To)

0 commit comments

Comments
 (0)