Skip to content

Commit 0e4e08b

Browse files
committed
run swift format for Swift 5.1
1 parent 7ce43f2 commit 0e4e08b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+135
-137
lines changed

.swiftformat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--exclude .build
22
--exclude .swiftpm
3-
--swiftversion 5.0
3+
--swiftversion 5.1
44
--disable redundantSelf
55
--disable sortedImports
66
--disable blankLinesAtStartOfScope

Sources/Core/Glob.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public class Glob: Collection {
6262
public let behavior: Behavior
6363
public let blacklistedDirectories: [String]
6464
var paths = [String]()
65-
public var startIndex: Int { return paths.startIndex }
66-
public var endIndex: Int { return paths.endIndex }
65+
public var startIndex: Int { paths.startIndex }
66+
public var endIndex: Int { paths.endIndex }
6767

6868
/// Initialize a glob
6969
///
@@ -109,21 +109,21 @@ public class Glob: Collection {
109109
// MARK: Subscript Support
110110

111111
public subscript(i: Int) -> String {
112-
return paths[i]
112+
paths[i]
113113
}
114114

115115
// MARK: Protocol of IndexableBase
116116

117117
public func index(after i: Int) -> Int {
118-
return i + 1
118+
i + 1
119119
}
120120

121121
// MARK: Private
122122

123123
private var globalFlags = GLOB_TILDE | GLOB_BRACE | GLOB_MARK
124124

125125
private func executeGlob(pattern: UnsafePointer<CChar>, gt: UnsafeMutablePointer<glob_t>) -> Bool {
126-
return glob(pattern, globalFlags, nil, gt) == 0
126+
glob(pattern, globalFlags, nil, gt) == 0
127127
}
128128

129129
private func expandGlobstar(pattern: String) -> [String] {
@@ -171,7 +171,7 @@ public class Glob: Collection {
171171
}
172172

173173
private func exploreDirectories(path: String) throws -> [String] {
174-
return try FileManager.default.contentsOfDirectory(atPath: path)
174+
try FileManager.default.contentsOfDirectory(atPath: path)
175175
.compactMap { subpath -> [String]? in
176176
if blacklistedDirectories.contains(subpath) {
177177
return nil
@@ -228,6 +228,6 @@ public class Glob: Collection {
228228

229229
private extension Sequence {
230230
func array() -> [Element] {
231-
return Array(self)
231+
Array(self)
232232
}
233233
}

Sources/Core/MD5.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func arrayOfBytes<T>(_ value: T, length: Int? = nil) -> [UInt8] {
6868
extension Int {
6969
/** Array of bytes with optional padding (little-endian) */
7070
func bytes(_ totalBytes: Int = MemoryLayout<Int>.size) -> [UInt8] {
71-
return arrayOfBytes(self, length: totalBytes)
71+
arrayOfBytes(self, length: totalBytes)
7272
}
7373
}
7474

@@ -147,12 +147,12 @@ struct BytesSequence: Sequence {
147147
let data: [UInt8]
148148

149149
func makeIterator() -> BytesIterator {
150-
return BytesIterator(chunkSize: chunkSize, data: data)
150+
BytesIterator(chunkSize: chunkSize, data: data)
151151
}
152152
}
153153

154154
func rotateLeft(_ value: UInt32, bits: UInt32) -> UInt32 {
155-
return ((value << bits) & 0xFFFF_FFFF) | (value >> (32 - bits))
155+
((value << bits) & 0xFFFF_FFFF) | (value >> (32 - bits))
156156
}
157157

158158
class MD5: HashProtocol {

Sources/Core/PathExtensions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension Path {
1111
/// - `../a/b` simplifies to `../a/b`
1212
/// - `a/../../c` simplifies to `../c`
1313
public func simplifyingParentDirectoryReferences() -> Path {
14-
return normalize().components.reduce(Path(), +)
14+
normalize().components.reduce(Path(), +)
1515
}
1616

1717
/// Returns the relative path necessary to go from `base` to `self`.

Sources/ProjectSpec/AggregateTarget.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ public struct AggregateTarget: ProjectTarget {
3232
extension AggregateTarget: CustomStringConvertible {
3333

3434
public var description: String {
35-
return "\(name)\(targets.isEmpty ? "" : ": \(targets.joined(separator: ", "))")"
35+
"\(name)\(targets.isEmpty ? "" : ": \(targets.joined(separator: ", "))")"
3636
}
3737
}
3838

3939
extension AggregateTarget: Equatable {
4040

4141
public static func == (lhs: AggregateTarget, rhs: AggregateTarget) -> Bool {
42-
return lhs.name == rhs.name &&
42+
lhs.name == rhs.name &&
4343
lhs.targets == rhs.targets &&
4444
lhs.settings == rhs.settings &&
4545
lhs.configFiles == rhs.configFiles &&
@@ -64,7 +64,7 @@ extension AggregateTarget: NamedJSONDictionaryConvertible {
6464

6565
extension AggregateTarget: JSONEncodable {
6666
public func toJSONValue() -> Any {
67-
return [
67+
[
6868
"settings": settings.toJSONValue(),
6969
"targets": targets,
7070
"configFiles": configFiles,
@@ -78,7 +78,7 @@ extension AggregateTarget: JSONEncodable {
7878
extension AggregateTarget: PathContainer {
7979

8080
static var pathProperties: [PathProperty] {
81-
return [
81+
[
8282
.dictionary([
8383
.string("configFiles"),
8484
.object("buildScripts", BuildScript.pathProperties),

Sources/ProjectSpec/BuildScript.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ extension BuildScript: JSONEncodable {
9494
extension BuildScript: PathContainer {
9595

9696
static var pathProperties: [PathProperty] {
97-
return [
97+
[
9898
.string("path"),
9999
]
100100
}

Sources/ProjectSpec/Dependency.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public struct Dependency: Equatable {
3232
self.implicit = implicit
3333
self.weakLink = weakLink
3434
}
35-
35+
3636
public enum CarthageLinkType: String {
3737
case dynamic
3838
case `static`
39-
39+
4040
public static let `default` = dynamic
4141
}
4242

@@ -139,7 +139,7 @@ extension Dependency: JSONEncodable {
139139
extension Dependency: PathContainer {
140140

141141
static var pathProperties: [PathProperty] {
142-
return [
142+
[
143143
.string("framework"),
144144
]
145145
}

Sources/ProjectSpec/DeploymentTarget.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extension Version {
5555

5656
/// doesn't print patch if 0
5757
public var deploymentTarget: String {
58-
return "\(major).\(minor)\(patch > 0 ? ".\(patch)" : "")"
58+
"\(major).\(minor)\(patch > 0 ? ".\(patch)" : "")"
5959
}
6060
}
6161

@@ -81,7 +81,7 @@ extension DeploymentTarget: JSONObjectConvertible {
8181

8282
extension DeploymentTarget: JSONEncodable {
8383
public func toJSONValue() -> Any {
84-
return [
84+
[
8585
"iOS": iOS?.string,
8686
"tvOS": tvOS?.string,
8787
"watchOS": watchOS?.string,

Sources/ProjectSpec/Plist.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public struct Plist: Equatable {
1212
}
1313

1414
public static func == (lhs: Plist, rhs: Plist) -> Bool {
15-
return lhs.path == rhs.path &&
15+
lhs.path == rhs.path &&
1616
NSDictionary(dictionary: lhs.properties).isEqual(to: rhs.properties)
1717
}
1818
}
@@ -27,7 +27,7 @@ extension Plist: JSONObjectConvertible {
2727

2828
extension Plist: JSONEncodable {
2929
public func toJSONValue() -> Any {
30-
return [
30+
[
3131
"path": path,
3232
"properties": properties,
3333
]
@@ -37,7 +37,7 @@ extension Plist: JSONEncodable {
3737
extension Plist: PathContainer {
3838

3939
static var pathProperties: [PathProperty] {
40-
return [
40+
[
4141
.string("path"),
4242
]
4343
}

Sources/ProjectSpec/Project.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,27 @@ public struct Project: BuildSettingsContainer {
7979
}
8080

8181
public func getProjectReference(_ projectName: String) -> ProjectReference? {
82-
return projectReferencesMap[projectName]
82+
projectReferencesMap[projectName]
8383
}
8484

8585
public func getTarget(_ targetName: String) -> Target? {
86-
return targetsMap[targetName]
86+
targetsMap[targetName]
8787
}
8888

8989
public func getAggregateTarget(_ targetName: String) -> AggregateTarget? {
90-
return aggregateTargetsMap[targetName]
90+
aggregateTargetsMap[targetName]
9191
}
9292

9393
public func getProjectTarget(_ targetName: String) -> ProjectTarget? {
94-
return targetsMap[targetName] ?? aggregateTargetsMap[targetName]
94+
targetsMap[targetName] ?? aggregateTargetsMap[targetName]
9595
}
9696

9797
public func getConfig(_ configName: String) -> Config? {
98-
return configs.first { $0.name == configName }
98+
configs.first { $0.name == configName }
9999
}
100100

101101
public var defaultProjectPath: Path {
102-
return basePath + "\(name).xcodeproj"
102+
basePath + "\(name).xcodeproj"
103103
}
104104
}
105105

@@ -136,7 +136,7 @@ extension Project: CustomDebugStringConvertible {
136136
extension Project: Equatable {
137137

138138
public static func == (lhs: Project, rhs: Project) -> Bool {
139-
return lhs.name == rhs.name &&
139+
lhs.name == rhs.name &&
140140
lhs.targets == rhs.targets &&
141141
lhs.aggregateTargets == rhs.aggregateTargets &&
142142
lhs.settings == rhs.settings &&
@@ -216,7 +216,7 @@ extension Project {
216216
extension Project: PathContainer {
217217

218218
static var pathProperties: [PathProperty] {
219-
return [
219+
[
220220
.string("configFiles"),
221221
.string("localPackages"),
222222
.object("options", SpecOptions.pathProperties),
@@ -259,13 +259,13 @@ extension Project {
259259
extension BuildSettingsContainer {
260260

261261
fileprivate var configFilePaths: [Path] {
262-
return configFiles.values.map { Path($0) }
262+
configFiles.values.map { Path($0) }
263263
}
264264
}
265265

266266
extension Project: JSONEncodable {
267267
public func toJSONValue() -> Any {
268-
return toJSONDictionary()
268+
toJSONDictionary()
269269
}
270270

271271
public func toJSONDictionary() -> JSONDictionary {

Sources/ProjectSpec/ProjectReference.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extension ProjectReference: NamedJSONDictionaryConvertible {
2020

2121
extension ProjectReference: JSONEncodable {
2222
public func toJSONValue() -> Any {
23-
return [
23+
[
2424
"path": path,
2525
]
2626
}

Sources/ProjectSpec/ProjectTarget.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ public protocol ProjectTarget: BuildSettingsContainer {
1111
extension Target {
1212

1313
public var buildScripts: [BuildScript] {
14-
return preBuildScripts + postCompileScripts + postBuildScripts
14+
preBuildScripts + postCompileScripts + postBuildScripts
1515
}
1616
}
1717

1818
extension Project {
1919

2020
public var projectTargets: [ProjectTarget] {
21-
return targets.map { $0 as ProjectTarget } + aggregateTargets.map { $0 as ProjectTarget }
21+
targets.map { $0 as ProjectTarget } + aggregateTargets.map { $0 as ProjectTarget }
2222
}
2323
}

Sources/ProjectSpec/Scheme.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public struct Scheme: Equatable {
126126
public static let randomExecutionOrderDefault = false
127127
public static let parallelizableDefault = false
128128

129-
public var name: String { return targetReference.name }
129+
public var name: String { targetReference.name }
130130
public let targetReference: TargetReference
131131
public var randomExecutionOrder: Bool
132132
public var parallelizable: Bool
@@ -187,7 +187,7 @@ public struct Scheme: Equatable {
187187
}
188188

189189
public var shouldUseLaunchSchemeArgsEnv: Bool {
190-
return commandLineArguments.isEmpty && environmentVariables.isEmpty
190+
commandLineArguments.isEmpty && environmentVariables.isEmpty
191191
}
192192
}
193193

@@ -219,7 +219,7 @@ public struct Scheme: Equatable {
219219
}
220220

221221
public var shouldUseLaunchSchemeArgsEnv: Bool {
222-
return commandLineArguments.isEmpty && environmentVariables.isEmpty
222+
commandLineArguments.isEmpty && environmentVariables.isEmpty
223223
}
224224
}
225225

@@ -272,7 +272,7 @@ extension Scheme.ExecutionAction: JSONObjectConvertible {
272272

273273
extension Scheme.ExecutionAction: JSONEncodable {
274274
public func toJSONValue() -> Any {
275-
return [
275+
[
276276
"script": script,
277277
"name": name,
278278
"settingsTarget": settingsTarget,
@@ -423,7 +423,7 @@ extension Scheme.Profile: JSONObjectConvertible {
423423

424424
extension Scheme.Profile: JSONEncodable {
425425
public func toJSONValue() -> Any {
426-
return [
426+
[
427427
"commandLineArguments": commandLineArguments,
428428
"preActions": preActions.map { $0.toJSONValue() },
429429
"postActions": postActions.map { $0.toJSONValue() },
@@ -442,7 +442,7 @@ extension Scheme.Analyze: JSONObjectConvertible {
442442

443443
extension Scheme.Analyze: JSONEncodable {
444444
public func toJSONValue() -> Any {
445-
return [
445+
[
446446
"config": config,
447447
]
448448
}
@@ -491,7 +491,7 @@ extension Scheme: NamedJSONDictionaryConvertible {
491491

492492
extension Scheme: JSONEncodable {
493493
public func toJSONValue() -> Any {
494-
return [
494+
[
495495
"build": build.toJSONValue(),
496496
"run": run?.toJSONValue(),
497497
"test": test?.toJSONValue(),
@@ -572,7 +572,7 @@ extension BuildType: JSONPrimitiveConvertible {
572572
}
573573

574574
public static var all: [BuildType] {
575-
return [.running, .testing, .profiling, .analyzing, .archiving]
575+
[.running, .testing, .profiling, .analyzing, .archiving]
576576
}
577577
}
578578

Sources/ProjectSpec/Settings.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public struct Settings: Equatable, JSONObjectConvertible, CustomStringConvertibl
3737
}
3838

3939
public static func == (lhs: Settings, rhs: Settings) -> Bool {
40-
return NSDictionary(dictionary: lhs.buildSettings).isEqual(to: rhs.buildSettings) &&
40+
NSDictionary(dictionary: lhs.buildSettings).isEqual(to: rhs.buildSettings) &&
4141
lhs.configSettings == rhs.configSettings &&
4242
lhs.groups == rhs.groups
4343
}
@@ -97,7 +97,7 @@ extension Dictionary where Key == String, Value: Any {
9797
}
9898

9999
public func equals(_ dictionary: BuildSettings) -> Bool {
100-
return NSDictionary(dictionary: self).isEqual(to: dictionary)
100+
NSDictionary(dictionary: self).isEqual(to: dictionary)
101101
}
102102
}
103103

Sources/ProjectSpec/SpecFile.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public struct SpecFile {
8686
}
8787

8888
public func resolvedDictionary(variables: [String: String] = [:]) -> JSONDictionary {
89-
return resolvedDictionaryWithUniqueTargets().expand(variables: variables)
89+
resolvedDictionaryWithUniqueTargets().expand(variables: variables)
9090
}
9191

9292
private func resolvedDictionaryWithUniqueTargets() -> JSONDictionary {

0 commit comments

Comments
 (0)