Merge pull request #377 from mas-cli/lint

🧹 Lint in GitHub Actions
This commit is contained in:
Ben Chatelain 2021-05-12 18:08:58 -06:00 committed by GitHub
commit 894447eede
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 53 additions and 41 deletions

View file

@ -3,7 +3,7 @@
#
# https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
name: Build & Test
name: Build, Test, and Lint
on: [push]
@ -11,6 +11,7 @@ jobs:
build-test:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
name: Build, Test, and Lint
runs-on: macOS-latest
steps:
@ -31,3 +32,6 @@ jobs:
- name: Test
run: script/test
- name: Lint
run: script/lint

View file

@ -89,7 +89,7 @@ uninstall:
script/uninstall
.PHONY: format
lint:
format:
script/format
.PHONY: lint

View file

@ -68,9 +68,9 @@
"package": "swift-format",
"repositoryURL": "https://github.com/apple/swift-format",
"state": {
"branch": null,
"branch": "swift-5.4-branch",
"revision": "9c15831b798d767c9af0927a931de5d557004936",
"version": "0.50400.0"
"version": null
}
},
{

View file

@ -70,12 +70,12 @@ let package = Package(
swiftLanguageVersions: [.v5]
)
#if swift(>=5.4)
#if compiler(>=5.4)
package.dependencies += [
.package(url: "https://github.com/apple/swift-format", from: "0.50400.0")
.package(url: "https://github.com/apple/swift-format", .branch("swift-5.4-branch"))
]
#elseif swift(>=5.3)
#elseif compiler(>=5.3)
package.dependencies += [
.package(url: "https://github.com/apple/swift-format", from: "0.50300.0")
.package(url: "https://github.com/apple/swift-format", .branch("swift-5.3-branch"))
]
#endif

View file

@ -8,7 +8,7 @@ A simple command line interface for the Mac App Store. Designed for scripting an
[![Swift 5](https://img.shields.io/badge/Language-Swift_5-orange.svg)](https://swift.org)
[![GitHub Release](https://img.shields.io/github/release/mas-cli/mas.svg)](https://github.com/mas-cli/mas/releases)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
[![Build & Test](https://github.com/mas-cli/mas/actions/workflows/build-test.yml/badge.svg?branch=main)](https://github.com/mas-cli/mas/actions/workflows/build-test.yml?query=branch%3Amain)
[![Build, Test, & Lint](https://github.com/mas-cli/mas/actions/workflows/build-test.yml/badge.svg?branch=main)](https://github.com/mas-cli/mas/actions/workflows/build-test.yml?query=branch%3Amain)
## 📲 Install

View file

@ -20,11 +20,13 @@ import StoreFoundation
func downloadAll(_ appIDs: [UInt64], purchase: Bool = false) -> Promise<Void> {
var firstError: Error?
return appIDs.reduce(Guarantee<Void>.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
}

View file

@ -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

View file

@ -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.

View file

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

View file

@ -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",

View file

@ -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",

View file

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

View file

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

View file

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

View file

@ -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",

View file

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

View file

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

View file

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

View file

@ -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",

View file

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

View file

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

View file

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

View file

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

View file

@ -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",

View file

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

View file

@ -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 {

View file

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

View file

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

View file

@ -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") {

View file

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

View file

@ -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] = []

View file

@ -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] = []

View file

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

View file

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

View file

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

View file

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

View file

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