From 990470715208dd290cf4cf21ae1aa9bcf05d2702 Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Sun, 9 May 2021 13:25:20 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Lint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/MasKit/AppStore/Downloader.swift | 13 ++++++++----- Sources/MasKit/Commands/Outdated.swift | 1 + Sources/MasKit/Commands/Upgrade.swift | 1 + Tests/MasKitTests/Commands/AccountCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/HomeCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/InfoCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/InstallCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/ListCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/LuckyCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/OpenCommandSpec.swift | 2 +- .../MasKitTests/Commands/OutdatedCommandSpec.swift | 2 +- .../MasKitTests/Commands/PurchaseCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/ResetCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/SearchCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/SignInCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/SignOutCommandSpec.swift | 2 +- .../MasKitTests/Commands/UninstallCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/UpgradeCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/VendorCommandSpec.swift | 2 +- Tests/MasKitTests/Commands/VersionCommandSpec.swift | 2 +- .../MasKitTests/Controllers/MasAppLibrarySpec.swift | 2 +- .../Controllers/MasStoreSearchSpec.swift | 2 +- Tests/MasKitTests/Controllers/StoreSearchMock.swift | 1 + Tests/MasKitTests/Controllers/StoreSearchSpec.swift | 3 ++- .../ExternalCommands/OpenSystemCommandSpec.swift | 2 +- .../Formatters/AppListFormatterSpec.swift | 2 +- .../Formatters/SearchResultFormatterSpec.swift | 2 +- Tests/MasKitTests/Models/SearchResultListSpec.swift | 2 +- Tests/MasKitTests/Models/SearchResultSpec.swift | 2 +- Tests/MasKitTests/Network/NetworkManagerTests.swift | 2 +- Tests/MasKitTests/Network/NetworkSessionMock.swift | 1 + Tests/MasKitTests/OutputListenerSpec.swift | 2 +- 32 files changed, 40 insertions(+), 32 deletions(-) diff --git a/Sources/MasKit/AppStore/Downloader.swift b/Sources/MasKit/AppStore/Downloader.swift index 831b6d0..2b631ad 100644 --- a/Sources/MasKit/AppStore/Downloader.swift +++ b/Sources/MasKit/AppStore/Downloader.swift @@ -20,11 +20,13 @@ import StoreFoundation func downloadAll(_ appIDs: [UInt64], purchase: Bool = false) -> Promise { var firstError: Error? return appIDs.reduce(Guarantee.value(())) { previous, appID in - previous.then { downloadWithRetries(appID, purchase: purchase).recover { error in - if firstError == nil { - firstError = error + previous.then { + downloadWithRetries(appID, purchase: purchase).recover { error in + if firstError == nil { + firstError = error + } } - } } + } }.done { if let error = firstError { throw error @@ -42,7 +44,8 @@ private func downloadWithRetries( // If the download failed due to network issues, try again. Otherwise, fail immediately. guard case MASError.downloadFailed(let downloadError) = error, - case NSURLErrorDomain = downloadError?.domain else { + case NSURLErrorDomain = downloadError?.domain + else { throw error } diff --git a/Sources/MasKit/Commands/Outdated.swift b/Sources/MasKit/Commands/Outdated.swift index da3c604..fcb26c2 100644 --- a/Sources/MasKit/Commands/Outdated.swift +++ b/Sources/MasKit/Commands/Outdated.swift @@ -9,6 +9,7 @@ import Commandant import Foundation import PromiseKit + import enum Swift.Result /// Command which displays a list of installed apps which have available updates diff --git a/Sources/MasKit/Commands/Upgrade.swift b/Sources/MasKit/Commands/Upgrade.swift index a48384a..1fdb75c 100644 --- a/Sources/MasKit/Commands/Upgrade.swift +++ b/Sources/MasKit/Commands/Upgrade.swift @@ -9,6 +9,7 @@ import Commandant import Foundation import PromiseKit + import enum Swift.Result /// Command which upgrades apps with new versions available in the Mac App Store. diff --git a/Tests/MasKitTests/Commands/AccountCommandSpec.swift b/Tests/MasKitTests/Commands/AccountCommandSpec.swift index 3a84b72..f2473cd 100644 --- a/Tests/MasKitTests/Commands/AccountCommandSpec.swift +++ b/Tests/MasKitTests/Commands/AccountCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class AccountCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/HomeCommandSpec.swift b/Tests/MasKitTests/Commands/HomeCommandSpec.swift index 8630ec8..ece1252 100644 --- a/Tests/MasKitTests/Commands/HomeCommandSpec.swift +++ b/Tests/MasKitTests/Commands/HomeCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class HomeCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { let result = SearchResult( trackId: 1111, trackViewUrl: "mas preview url", diff --git a/Tests/MasKitTests/Commands/InfoCommandSpec.swift b/Tests/MasKitTests/Commands/InfoCommandSpec.swift index a8893ef..b2bdc9c 100644 --- a/Tests/MasKitTests/Commands/InfoCommandSpec.swift +++ b/Tests/MasKitTests/Commands/InfoCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class InfoCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { let result = SearchResult( currentVersionReleaseDate: "2019-01-07T18:53:13Z", fileSizeBytes: "1024", diff --git a/Tests/MasKitTests/Commands/InstallCommandSpec.swift b/Tests/MasKitTests/Commands/InstallCommandSpec.swift index f0402a0..06b4bcd 100644 --- a/Tests/MasKitTests/Commands/InstallCommandSpec.swift +++ b/Tests/MasKitTests/Commands/InstallCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class InstallCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/ListCommandSpec.swift b/Tests/MasKitTests/Commands/ListCommandSpec.swift index aa834ae..7b47f84 100644 --- a/Tests/MasKitTests/Commands/ListCommandSpec.swift +++ b/Tests/MasKitTests/Commands/ListCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class ListCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/LuckyCommandSpec.swift b/Tests/MasKitTests/Commands/LuckyCommandSpec.swift index 6107f66..ec7cd03 100644 --- a/Tests/MasKitTests/Commands/LuckyCommandSpec.swift +++ b/Tests/MasKitTests/Commands/LuckyCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class LuckyCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/OpenCommandSpec.swift b/Tests/MasKitTests/Commands/OpenCommandSpec.swift index 7c3a2ee..c01dcd4 100644 --- a/Tests/MasKitTests/Commands/OpenCommandSpec.swift +++ b/Tests/MasKitTests/Commands/OpenCommandSpec.swift @@ -13,7 +13,7 @@ import Quick @testable import MasKit public class OpenCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { let result = SearchResult( trackId: 1111, trackViewUrl: "fakescheme://some/url", diff --git a/Tests/MasKitTests/Commands/OutdatedCommandSpec.swift b/Tests/MasKitTests/Commands/OutdatedCommandSpec.swift index f8fef58..bc8d0ca 100644 --- a/Tests/MasKitTests/Commands/OutdatedCommandSpec.swift +++ b/Tests/MasKitTests/Commands/OutdatedCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class OutdatedCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/PurchaseCommandSpec.swift b/Tests/MasKitTests/Commands/PurchaseCommandSpec.swift index e35d43b..6ead96d 100644 --- a/Tests/MasKitTests/Commands/PurchaseCommandSpec.swift +++ b/Tests/MasKitTests/Commands/PurchaseCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class PurchaseCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/ResetCommandSpec.swift b/Tests/MasKitTests/Commands/ResetCommandSpec.swift index 1763b09..cefa4d3 100644 --- a/Tests/MasKitTests/Commands/ResetCommandSpec.swift +++ b/Tests/MasKitTests/Commands/ResetCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class ResetCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/SearchCommandSpec.swift b/Tests/MasKitTests/Commands/SearchCommandSpec.swift index b10d9fe..7e2e98d 100644 --- a/Tests/MasKitTests/Commands/SearchCommandSpec.swift +++ b/Tests/MasKitTests/Commands/SearchCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class SearchCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { let result = SearchResult( trackId: 1111, trackName: "slack", diff --git a/Tests/MasKitTests/Commands/SignInCommandSpec.swift b/Tests/MasKitTests/Commands/SignInCommandSpec.swift index f9852a1..7d386ce 100644 --- a/Tests/MasKitTests/Commands/SignInCommandSpec.swift +++ b/Tests/MasKitTests/Commands/SignInCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class SignInCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/SignOutCommandSpec.swift b/Tests/MasKitTests/Commands/SignOutCommandSpec.swift index 94bcfe9..2e13782 100644 --- a/Tests/MasKitTests/Commands/SignOutCommandSpec.swift +++ b/Tests/MasKitTests/Commands/SignOutCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class SignOutCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/UninstallCommandSpec.swift b/Tests/MasKitTests/Commands/UninstallCommandSpec.swift index 3d100fb..5aafeac 100644 --- a/Tests/MasKitTests/Commands/UninstallCommandSpec.swift +++ b/Tests/MasKitTests/Commands/UninstallCommandSpec.swift @@ -13,7 +13,7 @@ import Quick @testable import MasKit public class UninstallCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/UpgradeCommandSpec.swift b/Tests/MasKitTests/Commands/UpgradeCommandSpec.swift index 01011e8..a41cb1c 100644 --- a/Tests/MasKitTests/Commands/UpgradeCommandSpec.swift +++ b/Tests/MasKitTests/Commands/UpgradeCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class UpgradeCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Commands/VendorCommandSpec.swift b/Tests/MasKitTests/Commands/VendorCommandSpec.swift index d1dbbd5..5e342cb 100644 --- a/Tests/MasKitTests/Commands/VendorCommandSpec.swift +++ b/Tests/MasKitTests/Commands/VendorCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class VendorCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { let result = SearchResult( trackId: 1111, trackViewUrl: "https://awesome.app", diff --git a/Tests/MasKitTests/Commands/VersionCommandSpec.swift b/Tests/MasKitTests/Commands/VersionCommandSpec.swift index 7abd19e..b0fe53a 100644 --- a/Tests/MasKitTests/Commands/VersionCommandSpec.swift +++ b/Tests/MasKitTests/Commands/VersionCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class VersionCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Controllers/MasAppLibrarySpec.swift b/Tests/MasKitTests/Controllers/MasAppLibrarySpec.swift index 26e0d7a..a5e0639 100644 --- a/Tests/MasKitTests/Controllers/MasAppLibrarySpec.swift +++ b/Tests/MasKitTests/Controllers/MasAppLibrarySpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class MasAppLibrarySpec: QuickSpec { - public override func spec() { + override public func spec() { let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps)) beforeSuite { diff --git a/Tests/MasKitTests/Controllers/MasStoreSearchSpec.swift b/Tests/MasKitTests/Controllers/MasStoreSearchSpec.swift index 4599b78..f709fa3 100644 --- a/Tests/MasKitTests/Controllers/MasStoreSearchSpec.swift +++ b/Tests/MasKitTests/Controllers/MasStoreSearchSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class MasStoreSearchSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Controllers/StoreSearchMock.swift b/Tests/MasKitTests/Controllers/StoreSearchMock.swift index 2873e60..69f518d 100644 --- a/Tests/MasKitTests/Controllers/StoreSearchMock.swift +++ b/Tests/MasKitTests/Controllers/StoreSearchMock.swift @@ -7,6 +7,7 @@ // import PromiseKit + @testable import MasKit class StoreSearchMock: StoreSearch { diff --git a/Tests/MasKitTests/Controllers/StoreSearchSpec.swift b/Tests/MasKitTests/Controllers/StoreSearchSpec.swift index 59c1520..b391e08 100644 --- a/Tests/MasKitTests/Controllers/StoreSearchSpec.swift +++ b/Tests/MasKitTests/Controllers/StoreSearchSpec.swift @@ -9,6 +9,7 @@ import Nimble import PromiseKit import Quick + @testable import MasKit /// Protocol minimal implementation @@ -23,7 +24,7 @@ struct StoreSearchForTesting: StoreSearch { } public class StoreSearchSpec: QuickSpec { - public override func spec() { + override public func spec() { let storeSearch = StoreSearchForTesting() describe("url string") { diff --git a/Tests/MasKitTests/ExternalCommands/OpenSystemCommandSpec.swift b/Tests/MasKitTests/ExternalCommands/OpenSystemCommandSpec.swift index 13236e7..9e479fc 100644 --- a/Tests/MasKitTests/ExternalCommands/OpenSystemCommandSpec.swift +++ b/Tests/MasKitTests/ExternalCommands/OpenSystemCommandSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class OpenSystemCommandSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Formatters/AppListFormatterSpec.swift b/Tests/MasKitTests/Formatters/AppListFormatterSpec.swift index 147d8b7..91b6faf 100644 --- a/Tests/MasKitTests/Formatters/AppListFormatterSpec.swift +++ b/Tests/MasKitTests/Formatters/AppListFormatterSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class AppListsFormatterSpec: QuickSpec { - public override func spec() { + override public func spec() { // static func reference let format = AppListFormatter.format(products:) var products: [SoftwareProduct] = [] diff --git a/Tests/MasKitTests/Formatters/SearchResultFormatterSpec.swift b/Tests/MasKitTests/Formatters/SearchResultFormatterSpec.swift index 00d1fec..1fe7fb7 100644 --- a/Tests/MasKitTests/Formatters/SearchResultFormatterSpec.swift +++ b/Tests/MasKitTests/Formatters/SearchResultFormatterSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class SearchResultsFormatterSpec: QuickSpec { - public override func spec() { + override public func spec() { // static func reference let format = SearchResultFormatter.format(results:includePrice:) var results: [SearchResult] = [] diff --git a/Tests/MasKitTests/Models/SearchResultListSpec.swift b/Tests/MasKitTests/Models/SearchResultListSpec.swift index 6cb11d4..137c907 100644 --- a/Tests/MasKitTests/Models/SearchResultListSpec.swift +++ b/Tests/MasKitTests/Models/SearchResultListSpec.swift @@ -13,7 +13,7 @@ import Quick @testable import MasKit public class SearchResultListSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Models/SearchResultSpec.swift b/Tests/MasKitTests/Models/SearchResultSpec.swift index be149d2..563946b 100644 --- a/Tests/MasKitTests/Models/SearchResultSpec.swift +++ b/Tests/MasKitTests/Models/SearchResultSpec.swift @@ -13,7 +13,7 @@ import Quick @testable import MasKit public class SearchResultSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() } diff --git a/Tests/MasKitTests/Network/NetworkManagerTests.swift b/Tests/MasKitTests/Network/NetworkManagerTests.swift index 71b291d..1d73534 100644 --- a/Tests/MasKitTests/Network/NetworkManagerTests.swift +++ b/Tests/MasKitTests/Network/NetworkManagerTests.swift @@ -11,7 +11,7 @@ import XCTest @testable import MasKit class NetworkManagerTests: XCTestCase { - public override func setUp() { + override public func setUp() { super.setUp() MasKit.initialize() } diff --git a/Tests/MasKitTests/Network/NetworkSessionMock.swift b/Tests/MasKitTests/Network/NetworkSessionMock.swift index 5455aeb..8715858 100644 --- a/Tests/MasKitTests/Network/NetworkSessionMock.swift +++ b/Tests/MasKitTests/Network/NetworkSessionMock.swift @@ -8,6 +8,7 @@ import Foundation import PromiseKit + @testable import MasKit /// Mock NetworkSession for testing. diff --git a/Tests/MasKitTests/OutputListenerSpec.swift b/Tests/MasKitTests/OutputListenerSpec.swift index 8505a72..f793f19 100644 --- a/Tests/MasKitTests/OutputListenerSpec.swift +++ b/Tests/MasKitTests/OutputListenerSpec.swift @@ -12,7 +12,7 @@ import Quick @testable import MasKit public class OutputListenerSpec: QuickSpec { - public override func spec() { + override public func spec() { beforeSuite { MasKit.initialize() }