🧹 Lint

This commit is contained in:
Chris Araman 2021-05-09 13:25:20 -07:00
parent d39058c7be
commit 9904707152
No known key found for this signature in database
GPG key ID: BB4499D9E11B61E0
32 changed files with 40 additions and 32 deletions

View file

@ -20,11 +20,13 @@ import StoreFoundation
func downloadAll(_ appIDs: [UInt64], purchase: Bool = false) -> Promise<Void> { func downloadAll(_ appIDs: [UInt64], purchase: Bool = false) -> Promise<Void> {
var firstError: Error? var firstError: Error?
return appIDs.reduce(Guarantee<Void>.value(())) { previous, appID in return appIDs.reduce(Guarantee<Void>.value(())) { previous, appID in
previous.then { downloadWithRetries(appID, purchase: purchase).recover { error in previous.then {
if firstError == nil { downloadWithRetries(appID, purchase: purchase).recover { error in
firstError = error if firstError == nil {
firstError = error
}
} }
} } }
}.done { }.done {
if let error = firstError { if let error = firstError {
throw error throw error
@ -42,7 +44,8 @@ private func downloadWithRetries(
// If the download failed due to network issues, try again. Otherwise, fail immediately. // If the download failed due to network issues, try again. Otherwise, fail immediately.
guard case MASError.downloadFailed(let downloadError) = error, guard case MASError.downloadFailed(let downloadError) = error,
case NSURLErrorDomain = downloadError?.domain else { case NSURLErrorDomain = downloadError?.domain
else {
throw error throw error
} }

View file

@ -9,6 +9,7 @@
import Commandant import Commandant
import Foundation import Foundation
import PromiseKit import PromiseKit
import enum Swift.Result import enum Swift.Result
/// Command which displays a list of installed apps which have available updates /// Command which displays a list of installed apps which have available updates

View file

@ -9,6 +9,7 @@
import Commandant import Commandant
import Foundation import Foundation
import PromiseKit import PromiseKit
import enum Swift.Result import enum Swift.Result
/// Command which upgrades apps with new versions available in the Mac App Store. /// Command which upgrades apps with new versions available in the Mac App Store.

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class AccountCommandSpec: QuickSpec { public class AccountCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class HomeCommandSpec: QuickSpec { public class HomeCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
let result = SearchResult( let result = SearchResult(
trackId: 1111, trackId: 1111,
trackViewUrl: "mas preview url", trackViewUrl: "mas preview url",

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class InfoCommandSpec: QuickSpec { public class InfoCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
let result = SearchResult( let result = SearchResult(
currentVersionReleaseDate: "2019-01-07T18:53:13Z", currentVersionReleaseDate: "2019-01-07T18:53:13Z",
fileSizeBytes: "1024", fileSizeBytes: "1024",

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class InstallCommandSpec: QuickSpec { public class InstallCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class ListCommandSpec: QuickSpec { public class ListCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class LuckyCommandSpec: QuickSpec { public class LuckyCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -13,7 +13,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class OpenCommandSpec: QuickSpec { public class OpenCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
let result = SearchResult( let result = SearchResult(
trackId: 1111, trackId: 1111,
trackViewUrl: "fakescheme://some/url", trackViewUrl: "fakescheme://some/url",

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class OutdatedCommandSpec: QuickSpec { public class OutdatedCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class PurchaseCommandSpec: QuickSpec { public class PurchaseCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class ResetCommandSpec: QuickSpec { public class ResetCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class SearchCommandSpec: QuickSpec { public class SearchCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
let result = SearchResult( let result = SearchResult(
trackId: 1111, trackId: 1111,
trackName: "slack", trackName: "slack",

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class SignInCommandSpec: QuickSpec { public class SignInCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class SignOutCommandSpec: QuickSpec { public class SignOutCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -13,7 +13,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class UninstallCommandSpec: QuickSpec { public class UninstallCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class UpgradeCommandSpec: QuickSpec { public class UpgradeCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class VendorCommandSpec: QuickSpec { public class VendorCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
let result = SearchResult( let result = SearchResult(
trackId: 1111, trackId: 1111,
trackViewUrl: "https://awesome.app", trackViewUrl: "https://awesome.app",

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class VersionCommandSpec: QuickSpec { public class VersionCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class MasAppLibrarySpec: QuickSpec { public class MasAppLibrarySpec: QuickSpec {
public override func spec() { override public func spec() {
let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps)) let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps))
beforeSuite { beforeSuite {

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class MasStoreSearchSpec: QuickSpec { public class MasStoreSearchSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -7,6 +7,7 @@
// //
import PromiseKit import PromiseKit
@testable import MasKit @testable import MasKit
class StoreSearchMock: StoreSearch { class StoreSearchMock: StoreSearch {

View file

@ -9,6 +9,7 @@
import Nimble import Nimble
import PromiseKit import PromiseKit
import Quick import Quick
@testable import MasKit @testable import MasKit
/// Protocol minimal implementation /// Protocol minimal implementation
@ -23,7 +24,7 @@ struct StoreSearchForTesting: StoreSearch {
} }
public class StoreSearchSpec: QuickSpec { public class StoreSearchSpec: QuickSpec {
public override func spec() { override public func spec() {
let storeSearch = StoreSearchForTesting() let storeSearch = StoreSearchForTesting()
describe("url string") { describe("url string") {

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class OpenSystemCommandSpec: QuickSpec { public class OpenSystemCommandSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class AppListsFormatterSpec: QuickSpec { public class AppListsFormatterSpec: QuickSpec {
public override func spec() { override public func spec() {
// static func reference // static func reference
let format = AppListFormatter.format(products:) let format = AppListFormatter.format(products:)
var products: [SoftwareProduct] = [] var products: [SoftwareProduct] = []

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class SearchResultsFormatterSpec: QuickSpec { public class SearchResultsFormatterSpec: QuickSpec {
public override func spec() { override public func spec() {
// static func reference // static func reference
let format = SearchResultFormatter.format(results:includePrice:) let format = SearchResultFormatter.format(results:includePrice:)
var results: [SearchResult] = [] var results: [SearchResult] = []

View file

@ -13,7 +13,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class SearchResultListSpec: QuickSpec { public class SearchResultListSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -13,7 +13,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class SearchResultSpec: QuickSpec { public class SearchResultSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }

View file

@ -11,7 +11,7 @@ import XCTest
@testable import MasKit @testable import MasKit
class NetworkManagerTests: XCTestCase { class NetworkManagerTests: XCTestCase {
public override func setUp() { override public func setUp() {
super.setUp() super.setUp()
MasKit.initialize() MasKit.initialize()
} }

View file

@ -8,6 +8,7 @@
import Foundation import Foundation
import PromiseKit import PromiseKit
@testable import MasKit @testable import MasKit
/// Mock NetworkSession for testing. /// Mock NetworkSession for testing.

View file

@ -12,7 +12,7 @@ import Quick
@testable import MasKit @testable import MasKit
public class OutputListenerSpec: QuickSpec { public class OutputListenerSpec: QuickSpec {
public override func spec() { override public func spec() {
beforeSuite { beforeSuite {
MasKit.initialize() MasKit.initialize()
} }