File tree Expand file tree Collapse file tree 4 files changed +6
-8
lines changed
Sources/SourcePackagesParser Expand file tree Collapse file tree 4 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ enum LicenseType: String {
18
18
case zlib = " zLib License "
19
19
20
20
init ( licenseText: String ) {
21
- let text = licenseText. replace ( pattern : #"( +|\n)"# , expect : " " )
21
+ let text = licenseText. replace ( of : #"( +|\n)"# , with : " " )
22
22
23
23
if text. contains ( " Apache License " ) || text. contains ( APACHE_2_TEXT) {
24
24
self = . apache_2
Original file line number Diff line number Diff line change @@ -21,8 +21,7 @@ final class SourcePackagesParser {
21
21
let workspaceStateURL = URL ( fileURLWithPath: sourcePackagesPath)
22
22
. appendingPathComponent ( " workspace-state.json " )
23
23
guard let data = try ? Data ( contentsOf: workspaceStateURL) ,
24
- let workspaceState = try ? JSONDecoder ( ) . decode ( WorkspaceState . self, from: data)
25
- else {
24
+ let workspaceState = try ? JSONDecoder ( ) . decode ( WorkspaceState . self, from: data) else {
26
25
throw SPPError . couldNotReadFile ( workspaceStateURL. lastPathComponent)
27
26
}
28
27
@@ -40,7 +39,6 @@ final class SourcePackagesParser {
40
39
return Library ( name: dependency. packageRef. name,
41
40
licenseType: license. 0 ,
42
41
licenseBody: license. 1 )
43
-
44
42
}
45
43
. sorted { $0. name. lowercased ( ) < $1. name. lowercased ( ) }
46
44
Original file line number Diff line number Diff line change 8
8
import Foundation
9
9
10
10
extension String {
11
- func replace( pattern : String , expect : String ) -> String {
12
- return self . replacingOccurrences ( of: pattern ,
13
- with: expect ,
11
+ func replace( of regexPattern : String , with replacement : String ) -> String {
12
+ return self . replacingOccurrences ( of: regexPattern ,
13
+ with: replacement ,
14
14
options: . regularExpression,
15
15
range: self . range ( of: self ) )
16
16
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import Foundation
9
9
10
10
func exitWithUsage( ) -> Never {
11
11
print ( " USAGE: swift run spp [base directory path] [SourcePackages directory path] " )
12
- return exit ( 1 )
12
+ exit ( 1 )
13
13
}
14
14
15
15
func exitWithSPPError( _ sppError: SPPError ) -> Never {
You can’t perform that action at this time.
0 commit comments