From 749c22913330b7ae5d437a0e3efaae8513cf78ac Mon Sep 17 00:00:00 2001 From: Masayuki Ono Date: Tue, 1 Mar 2022 14:00:50 +0900 Subject: [PATCH] Fix warnings --- Sources/LicensePlistCore/Entity/SwiftPackage.swift | 8 +++----- .../Entity/SwiftPackageManagerTests.swift | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Sources/LicensePlistCore/Entity/SwiftPackage.swift b/Sources/LicensePlistCore/Entity/SwiftPackage.swift index 3933a8ef..068cace0 100644 --- a/Sources/LicensePlistCore/Entity/SwiftPackage.swift +++ b/Sources/LicensePlistCore/Entity/SwiftPackage.swift @@ -41,7 +41,7 @@ struct SwiftPackageV2: Decodable { let revision: String? let version: String? } - + let identity: String let location: String let state: State @@ -59,13 +59,11 @@ extension SwiftPackage { return resolvedPackagesV1.object.pins.map { SwiftPackage(package: $0.package, repositoryURL: $0.repositoryURL, revision: $0.state.revision, version: $0.state.version) } - } - else if let resolvedPackagesV2 = try? JSONDecoder().decode(ResolvedPackagesV2.self, from: data) { + } else if let resolvedPackagesV2 = try? JSONDecoder().decode(ResolvedPackagesV2.self, from: data) { return resolvedPackagesV2.pins.map { SwiftPackage(package: $0.identity, repositoryURL: $0.location, revision: $0.state.revision, version: $0.state.version) } - } - else { + } else { return [] } } diff --git a/Tests/LicensePlistTests/Entity/SwiftPackageManagerTests.swift b/Tests/LicensePlistTests/Entity/SwiftPackageManagerTests.swift index cd51a48d..fd3424e0 100644 --- a/Tests/LicensePlistTests/Entity/SwiftPackageManagerTests.swift +++ b/Tests/LicensePlistTests/Entity/SwiftPackageManagerTests.swift @@ -76,7 +76,7 @@ class SwiftPackageManagerTests: XCTestCase { XCTAssertEqual(package.state.branch, "master") XCTAssertNil(package.state.version) } - + func testDecodingWithVersionV2() throws { let jsonString = """ { @@ -99,7 +99,7 @@ class SwiftPackageManagerTests: XCTestCase { XCTAssertNil(package.state.branch) XCTAssertEqual(package.state.version, "4.1.0") } - + func testDecodingWithBranchV2() throws { let jsonString = """ {