Skip to content

Commit 95e3d30

Browse files
committed
Run SwiftFormat on changes
1 parent ce71f81 commit 95e3d30

File tree

4 files changed

+31
-23
lines changed

4 files changed

+31
-23
lines changed

Sources/Basics/SourceControlURL.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,24 @@ public struct SourceControlURL: Codable, Equatable, Hashable, Sendable {
4545
}
4646

4747
public var absoluteString: String {
48-
return self.urlString
48+
self.urlString
4949
}
5050

5151
public var lastPathComponent: String {
52-
return (self.urlString as NSString).lastPathComponent
52+
(self.urlString as NSString).lastPathComponent
5353
}
5454

5555
public var url: URL? {
56-
return URL(string: self.urlString)
56+
URL(string: self.urlString)
5757
}
5858
}
5959

6060
extension SourceControlURL: CustomStringConvertible {
6161
public var description: String {
62-
return self.urlString
62+
self.urlString
6363
}
6464
}
6565

66-
extension SourceControlURL: ExpressibleByStringInterpolation {
67-
}
66+
extension SourceControlURL: ExpressibleByStringInterpolation {}
6867

69-
extension SourceControlURL: ExpressibleByStringLiteral {
70-
}
68+
extension SourceControlURL: ExpressibleByStringLiteral {}

Sources/Commands/PackageCommands/AddDependency.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import Workspace
2424
extension SwiftPackageCommand {
2525
struct AddDependency: SwiftCommand {
2626
package static let configuration = CommandConfiguration(
27-
abstract: "Add a package dependency to the manifest")
27+
abstract: "Add a package dependency to the manifest"
28+
)
2829

2930
@Argument(help: "The URL or directory of the package to add")
3031
var dependency: String
@@ -126,24 +127,28 @@ extension SwiftPackageCommand {
126127
}
127128

128129
if requirements.count > 1 {
129-
throw StringError("must specify at most one of --exact, --branch, --revision, --from, or --up-to-next-minor-from")
130+
throw StringError(
131+
"must specify at most one of --exact, --branch, --revision, --from, or --up-to-next-minor-from"
132+
)
130133
}
131134

132135
guard let firstRequirement = requirements.first else {
133-
throw StringError("must specify one of --exact, --branch, --revision, --from, or --up-to-next-minor-from")
136+
throw StringError(
137+
"must specify one of --exact, --branch, --revision, --from, or --up-to-next-minor-from"
138+
)
134139
}
135140

136141
let requirement: PackageDependency.SourceControl.Requirement
137142
if case .range(let range) = firstRequirement {
138143
if let to {
139-
requirement = .range(range.lowerBound..<to)
144+
requirement = .range(range.lowerBound ..< to)
140145
} else {
141146
requirement = .range(range)
142147
}
143148
} else {
144149
requirement = firstRequirement
145150

146-
if to != nil {
151+
if self.to != nil {
147152
throw StringError("--to can only be specified with --from or --up-to-next-minor-from")
148153
}
149154
}
@@ -197,7 +202,7 @@ extension SwiftPackageCommand {
197202
to: fileSystem,
198203
manifest: manifestSyntax,
199204
manifestPath: manifestPath,
200-
verbose: !globalOptions.logging.quiet
205+
verbose: !self.globalOptions.logging.quiet
201206
)
202207
}
203208
}

Sources/PackageModelSyntax/PackageDependency+Syntax.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
import Basics
1414
import PackageModel
15-
import SwiftSyntax
1615
import SwiftParser
16+
import SwiftSyntax
1717
import struct TSCUtility.Version
1818

1919
extension PackageDependency: ManifestSyntaxRepresentable {
@@ -88,6 +88,6 @@ extension PackageDependency.SourceControl.Requirement: ManifestSyntaxRepresentab
8888

8989
extension Version: ManifestSyntaxRepresentable {
9090
func asSyntax() -> ExprSyntax {
91-
return "\(literal: description)"
91+
"\(literal: description)"
9292
}
9393
}

Tests/CommandsTests/PackageCommandTests.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Basics
14-
@testable import CoreCommands
1514
@testable import Commands
15+
@testable import CoreCommands
1616
import Foundation
1717

1818
@_spi(DontAdoptOutsideOfSwiftPMExposedForBenchmarksAndTestsOnly)
1919
import PackageGraph
2020

21+
import _InternalTestSupport
2122
import PackageLoading
2223
import PackageModel
2324
import SourceControl
24-
import _InternalTestSupport
2525
import Workspace
2626
import XCTest
2727

28-
import struct TSCBasic.ByteString
28+
import class Basics.AsyncProcess
2929
import class TSCBasic.BufferedOutputByteStream
30+
import struct TSCBasic.ByteString
3031
import class TSCBasic.InMemoryFileSystem
3132
import enum TSCBasic.JSON
32-
import class Basics.AsyncProcess
3333

3434
final class PackageCommandTests: CommandsTestCase {
3535
@discardableResult
@@ -800,7 +800,9 @@ final class PackageCommandTests: CommandsTestCase {
800800
let path = tmpPath.appending("PackageB")
801801
try fs.createDirectory(path)
802802

803-
try fs.writeFileContents(path.appending("Package.swift"), string:
803+
try fs.writeFileContents(
804+
path.appending("Package.swift"),
805+
string:
804806
"""
805807
// swift-tools-version: 5.9
806808
import PackageDescription
@@ -811,7 +813,7 @@ final class PackageCommandTests: CommandsTestCase {
811813
"""
812814
)
813815

814-
_ = try await execute(
816+
_ = try await self.execute(
815817
[
816818
"add-dependency",
817819
"https://github.com/swiftlang/swift-syntax.git",
@@ -825,7 +827,10 @@ final class PackageCommandTests: CommandsTestCase {
825827
XCTAssertFileExists(manifest)
826828
let contents: String = try fs.readFileContents(manifest)
827829

828-
XCTAssertMatch(contents, .contains(#".package(url: "https://github.com/swiftlang/swift-syntax.git", branch: "main"),"#))
830+
XCTAssertMatch(
831+
contents,
832+
.contains(#".package(url: "https://github.com/swiftlang/swift-syntax.git", branch: "main"),"#)
833+
)
829834
}
830835
}
831836

0 commit comments

Comments
 (0)