From 0b8acab235dbf380ec99c8c63e52fd3055134d85 Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Sat, 8 May 2021 15:49:32 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Lint=20with=20periphery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Brewfile | 3 +++ Brewfile.lock.json | 13 ++++++++++++- Sources/MasKit/AppStore/ISStoreAccount.swift | 4 ---- Sources/MasKit/AppStore/StoreAccount.swift | 4 ---- .../MasKit/ExternalCommands/ExternalCommand.swift | 6 ------ Sources/MasKit/Models/SoftwareProduct.swift | 9 --------- Tests/MasKitTests/Commands/AccountCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/HomeCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/InfoCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/InstallCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/ListCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/LuckyCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/OpenCommandSpec.swift | 4 ++-- .../MasKitTests/Commands/OutdatedCommandSpec.swift | 4 ++-- .../MasKitTests/Commands/PurchaseCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/ResetCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/SearchCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/SignInCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/SignOutCommandSpec.swift | 4 ++-- .../MasKitTests/Commands/UninstallCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/UpgradeCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/VendorCommandSpec.swift | 4 ++-- Tests/MasKitTests/Commands/VersionCommandSpec.swift | 4 ++-- Tests/MasKitTests/Controllers/AppLibraryMock.swift | 8 -------- .../MasKitTests/Controllers/MasAppLibrarySpec.swift | 4 ++-- .../Controllers/MasStoreSearchSpec.swift | 4 ++-- Tests/MasKitTests/Controllers/StoreSearchSpec.swift | 4 ++-- .../ExternalCommands/OpenSystemCommandSpec.swift | 4 ++-- .../Formatters/AppListFormatterSpec.swift | 4 ++-- .../Formatters/SearchResultFormatterSpec.swift | 4 ++-- Tests/MasKitTests/Models/SearchResultListSpec.swift | 4 ++-- Tests/MasKitTests/Models/SearchResultSpec.swift | 4 ++-- Tests/MasKitTests/Network/NetworkSessionMock.swift | 2 -- Tests/MasKitTests/OutputListenerSpec.swift | 4 ++-- script/lint | 3 ++- 35 files changed, 69 insertions(+), 87 deletions(-) diff --git a/Brewfile b/Brewfile index e8c9cec..da41e76 100644 --- a/Brewfile +++ b/Brewfile @@ -7,3 +7,6 @@ brew "swiftformat" tap "kylef/formulae" brew "swiftenv" + +tap "peripheryapp/periphery" +cask "periphery" diff --git a/Brewfile.lock.json b/Brewfile.lock.json index dc1f79c..977162b 100644 --- a/Brewfile.lock.json +++ b/Brewfile.lock.json @@ -96,6 +96,17 @@ "tap": { "kylef/formulae": { "revision": "00757e80d6861651d3dc18bbc978edf9a5d0a8a9" + }, + "peripheryapp/periphery": { + "revision": "85922da2070aec89444ade214be45271f33286a1" + } + }, + "cask": { + "periphery": { + "version": "2.4.3", + "options": { + "full_name": "periphery" + } } } }, @@ -104,7 +115,7 @@ "big_sur": { "HOMEBREW_VERSION": "3.1.5-146-g64b6846", "HOMEBREW_PREFIX": "/opt/homebrew", - "Homebrew/homebrew-core": "625fbbcc0d7c16be8838dc2c309714dd553ccbd1", + "Homebrew/homebrew-core": "9c6af5030d41978a1714f1c1dc5f0a8e452e308b", "CLT": "12.5.0.22.9", "Xcode": "12.5", "macOS": "11.3.1" diff --git a/Sources/MasKit/AppStore/ISStoreAccount.swift b/Sources/MasKit/AppStore/ISStoreAccount.swift index 8f0d0a9..5865332 100644 --- a/Sources/MasKit/AppStore/ISStoreAccount.swift +++ b/Sources/MasKit/AppStore/ISStoreAccount.swift @@ -10,10 +10,6 @@ import CommerceKit import StoreFoundation extension ISStoreAccount: StoreAccount { - static var primaryAccountIsPresentAndSignedIn: Bool { - CKAccountStore.shared().primaryAccountIsPresentAndSignedIn - } - static var primaryAccount: StoreAccount? { var account: ISStoreAccount? diff --git a/Sources/MasKit/AppStore/StoreAccount.swift b/Sources/MasKit/AppStore/StoreAccount.swift index 77852c9..6de28e4 100644 --- a/Sources/MasKit/AppStore/StoreAccount.swift +++ b/Sources/MasKit/AppStore/StoreAccount.swift @@ -7,9 +7,5 @@ // protocol StoreAccount { - static var primaryAccountIsPresentAndSignedIn: Bool { get } - static var primaryAccount: StoreAccount? { get } - static func signIn(username: String, password: String, systemDialog: Bool) throws -> StoreAccount - var identifier: String { get set } } diff --git a/Sources/MasKit/ExternalCommands/ExternalCommand.swift b/Sources/MasKit/ExternalCommands/ExternalCommand.swift index 785bc84..caf3ef0 100644 --- a/Sources/MasKit/ExternalCommands/ExternalCommand.swift +++ b/Sources/MasKit/ExternalCommands/ExternalCommand.swift @@ -14,7 +14,6 @@ protocol ExternalCommand { var process: Process { get } - var stdout: String { get } var stderr: String { get } var stdoutPipe: Pipe { get } var stderrPipe: Pipe { get } @@ -29,11 +28,6 @@ protocol ExternalCommand { /// Common implementation extension ExternalCommand { - var stdout: String { - let data = stdoutPipe.fileHandleForReading.readDataToEndOfFile() - return String(data: data, encoding: .utf8) ?? "" - } - var stderr: String { let data = stderrPipe.fileHandleForReading.readDataToEndOfFile() return String(data: data, encoding: .utf8) ?? "" diff --git a/Sources/MasKit/Models/SoftwareProduct.swift b/Sources/MasKit/Models/SoftwareProduct.swift index 6c5d129..2c40ef1 100644 --- a/Sources/MasKit/Models/SoftwareProduct.swift +++ b/Sources/MasKit/Models/SoftwareProduct.swift @@ -18,16 +18,7 @@ protocol SoftwareProduct { var itemIdentifier: NSNumber { get set } } -// MARK: - Equatable extension SoftwareProduct { - static func == (lhs: Self, rhs: Self) -> Bool { - lhs.appName == rhs.appName - && lhs.bundleIdentifier == rhs.bundleIdentifier - && lhs.bundlePath == rhs.bundlePath - && lhs.bundleVersion == rhs.bundleVersion - && lhs.itemIdentifier == rhs.itemIdentifier - } - /// Returns bundleIdentifier if appName is empty string. var appNameOrBundleIdentifier: String { appName.isEmpty ? bundleIdentifier : appName diff --git a/Tests/MasKitTests/Commands/AccountCommandSpec.swift b/Tests/MasKitTests/Commands/AccountCommandSpec.swift index b4971ea..8a3905f 100644 --- a/Tests/MasKitTests/Commands/AccountCommandSpec.swift +++ b/Tests/MasKitTests/Commands/AccountCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class AccountCommandSpec: QuickSpec { - override func spec() { +public class AccountCommandSpec: QuickSpec { + public override func spec() { describe("Account command") { it("displays active account") { let cmd = AccountCommand() diff --git a/Tests/MasKitTests/Commands/HomeCommandSpec.swift b/Tests/MasKitTests/Commands/HomeCommandSpec.swift index ce73704..bbcf6b6 100644 --- a/Tests/MasKitTests/Commands/HomeCommandSpec.swift +++ b/Tests/MasKitTests/Commands/HomeCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class HomeCommandSpec: QuickSpec { - override func spec() { +public class HomeCommandSpec: QuickSpec { + public override 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 0e964f6..dc5d7a6 100644 --- a/Tests/MasKitTests/Commands/InfoCommandSpec.swift +++ b/Tests/MasKitTests/Commands/InfoCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class InfoCommandSpec: QuickSpec { - override func spec() { +public class InfoCommandSpec: QuickSpec { + public override 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 54ef2a6..e692e46 100644 --- a/Tests/MasKitTests/Commands/InstallCommandSpec.swift +++ b/Tests/MasKitTests/Commands/InstallCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class InstallCommandSpec: QuickSpec { - override func spec() { +public class InstallCommandSpec: QuickSpec { + public override func spec() { describe("install command") { it("installs apps") { let cmd = InstallCommand() diff --git a/Tests/MasKitTests/Commands/ListCommandSpec.swift b/Tests/MasKitTests/Commands/ListCommandSpec.swift index 1878fe2..5c9cc02 100644 --- a/Tests/MasKitTests/Commands/ListCommandSpec.swift +++ b/Tests/MasKitTests/Commands/ListCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class ListCommandSpec: QuickSpec { - override func spec() { +public class ListCommandSpec: QuickSpec { + public override func spec() { describe("list command") { it("lists stuff") { let list = ListCommand() diff --git a/Tests/MasKitTests/Commands/LuckyCommandSpec.swift b/Tests/MasKitTests/Commands/LuckyCommandSpec.swift index 49adfea..0dd6375 100644 --- a/Tests/MasKitTests/Commands/LuckyCommandSpec.swift +++ b/Tests/MasKitTests/Commands/LuckyCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class LuckyCommandSpec: QuickSpec { - override func spec() { +public class LuckyCommandSpec: QuickSpec { + public override func spec() { describe("lucky command") { it("installs the first app matching a search") { let cmd = LuckyCommand() diff --git a/Tests/MasKitTests/Commands/OpenCommandSpec.swift b/Tests/MasKitTests/Commands/OpenCommandSpec.swift index 97383e7..1b192b3 100644 --- a/Tests/MasKitTests/Commands/OpenCommandSpec.swift +++ b/Tests/MasKitTests/Commands/OpenCommandSpec.swift @@ -12,8 +12,8 @@ import Quick @testable import MasKit -class OpenCommandSpec: QuickSpec { - override func spec() { +public class OpenCommandSpec: QuickSpec { + public override 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 44bebe3..65be5e2 100644 --- a/Tests/MasKitTests/Commands/OutdatedCommandSpec.swift +++ b/Tests/MasKitTests/Commands/OutdatedCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class OutdatedCommandSpec: QuickSpec { - override func spec() { +public class OutdatedCommandSpec: QuickSpec { + public override func spec() { describe("outdated command") { it("displays apps with pending updates") { let cmd = OutdatedCommand() diff --git a/Tests/MasKitTests/Commands/PurchaseCommandSpec.swift b/Tests/MasKitTests/Commands/PurchaseCommandSpec.swift index 800832a..f241d8a 100644 --- a/Tests/MasKitTests/Commands/PurchaseCommandSpec.swift +++ b/Tests/MasKitTests/Commands/PurchaseCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class PurchaseCommandSpec: QuickSpec { - override func spec() { +public class PurchaseCommandSpec: QuickSpec { + public override func spec() { describe("purchase command") { it("purchases apps") { let cmd = PurchaseCommand() diff --git a/Tests/MasKitTests/Commands/ResetCommandSpec.swift b/Tests/MasKitTests/Commands/ResetCommandSpec.swift index 52c685f..1145057 100644 --- a/Tests/MasKitTests/Commands/ResetCommandSpec.swift +++ b/Tests/MasKitTests/Commands/ResetCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class ResetCommandSpec: QuickSpec { - override func spec() { +public class ResetCommandSpec: QuickSpec { + public override func spec() { describe("reset command") { it("updates stuff") { let cmd = ResetCommand() diff --git a/Tests/MasKitTests/Commands/SearchCommandSpec.swift b/Tests/MasKitTests/Commands/SearchCommandSpec.swift index 042610d..d2017c1 100644 --- a/Tests/MasKitTests/Commands/SearchCommandSpec.swift +++ b/Tests/MasKitTests/Commands/SearchCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class SearchCommandSpec: QuickSpec { - override func spec() { +public class SearchCommandSpec: QuickSpec { + public override func spec() { let result = SearchResult( trackId: 1111, trackName: "slack", diff --git a/Tests/MasKitTests/Commands/SignInCommandSpec.swift b/Tests/MasKitTests/Commands/SignInCommandSpec.swift index 537dc86..ac40ad3 100644 --- a/Tests/MasKitTests/Commands/SignInCommandSpec.swift +++ b/Tests/MasKitTests/Commands/SignInCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class SignInCommandSpec: QuickSpec { - override func spec() { +public class SignInCommandSpec: QuickSpec { + public override func spec() { describe("signn command") { it("updates stuff") { let cmd = SignInCommand() diff --git a/Tests/MasKitTests/Commands/SignOutCommandSpec.swift b/Tests/MasKitTests/Commands/SignOutCommandSpec.swift index ad6de3e..95fd417 100644 --- a/Tests/MasKitTests/Commands/SignOutCommandSpec.swift +++ b/Tests/MasKitTests/Commands/SignOutCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class SignOutCommandSpec: QuickSpec { - override func spec() { +public class SignOutCommandSpec: QuickSpec { + public override func spec() { describe("signout command") { it("updates stuff") { let cmd = SignOutCommand() diff --git a/Tests/MasKitTests/Commands/UninstallCommandSpec.swift b/Tests/MasKitTests/Commands/UninstallCommandSpec.swift index eeef61a..8620b75 100644 --- a/Tests/MasKitTests/Commands/UninstallCommandSpec.swift +++ b/Tests/MasKitTests/Commands/UninstallCommandSpec.swift @@ -12,8 +12,8 @@ import Quick @testable import MasKit -class UninstallCommandSpec: QuickSpec { - override func spec() { +public class UninstallCommandSpec: QuickSpec { + public override func spec() { describe("uninstall command") { let appId = 12345 let app = SoftwareProductMock( diff --git a/Tests/MasKitTests/Commands/UpgradeCommandSpec.swift b/Tests/MasKitTests/Commands/UpgradeCommandSpec.swift index 3a863da..577f338 100644 --- a/Tests/MasKitTests/Commands/UpgradeCommandSpec.swift +++ b/Tests/MasKitTests/Commands/UpgradeCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class UpgradeCommandSpec: QuickSpec { - override func spec() { +public class UpgradeCommandSpec: QuickSpec { + public override func spec() { describe("upgrade command") { it("updates stuff") { let cmd = UpgradeCommand() diff --git a/Tests/MasKitTests/Commands/VendorCommandSpec.swift b/Tests/MasKitTests/Commands/VendorCommandSpec.swift index f1bfb1d..53ca8ff 100644 --- a/Tests/MasKitTests/Commands/VendorCommandSpec.swift +++ b/Tests/MasKitTests/Commands/VendorCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class VendorCommandSpec: QuickSpec { - override func spec() { +public class VendorCommandSpec: QuickSpec { + public override 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 a810724..e1e6f89 100644 --- a/Tests/MasKitTests/Commands/VersionCommandSpec.swift +++ b/Tests/MasKitTests/Commands/VersionCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class VersionCommandSpec: QuickSpec { - override func spec() { +public class VersionCommandSpec: QuickSpec { + public override func spec() { describe("version command") { it("displays the current version") { let cmd = VersionCommand() diff --git a/Tests/MasKitTests/Controllers/AppLibraryMock.swift b/Tests/MasKitTests/Controllers/AppLibraryMock.swift index 2290ad9..4ca7256 100644 --- a/Tests/MasKitTests/Controllers/AppLibraryMock.swift +++ b/Tests/MasKitTests/Controllers/AppLibraryMock.swift @@ -11,14 +11,6 @@ class AppLibraryMock: AppLibrary { var installedApps = [SoftwareProduct]() - /// Finds an app using a bundle identifier. - /// - /// - Parameter bundleId: Bundle identifier of app. - /// - Returns: Software Product of app if found; nil otherwise. - func installedApp(forBundleId _: String) -> SoftwareProduct? { - nil - } - func uninstallApp(app: SoftwareProduct) throws { if !installedApps.contains(where: { product -> Bool in app.itemIdentifier == product.itemIdentifier diff --git a/Tests/MasKitTests/Controllers/MasAppLibrarySpec.swift b/Tests/MasKitTests/Controllers/MasAppLibrarySpec.swift index 50921f8..ebde38f 100644 --- a/Tests/MasKitTests/Controllers/MasAppLibrarySpec.swift +++ b/Tests/MasKitTests/Controllers/MasAppLibrarySpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class MasAppLibrarySpec: QuickSpec { - override func spec() { +public class MasAppLibrarySpec: QuickSpec { + public override func spec() { let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps)) describe("mas app library") { diff --git a/Tests/MasKitTests/Controllers/MasStoreSearchSpec.swift b/Tests/MasKitTests/Controllers/MasStoreSearchSpec.swift index 63983e0..bc2018f 100644 --- a/Tests/MasKitTests/Controllers/MasStoreSearchSpec.swift +++ b/Tests/MasKitTests/Controllers/MasStoreSearchSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class MasStoreSearchSpec: QuickSpec { - override func spec() { +public class MasStoreSearchSpec: QuickSpec { + public override func spec() { describe("store") { context("when searched") { it("can find slack") { diff --git a/Tests/MasKitTests/Controllers/StoreSearchSpec.swift b/Tests/MasKitTests/Controllers/StoreSearchSpec.swift index 4e5bf6e..d41ce89 100644 --- a/Tests/MasKitTests/Controllers/StoreSearchSpec.swift +++ b/Tests/MasKitTests/Controllers/StoreSearchSpec.swift @@ -21,8 +21,8 @@ struct StoreSearchForTesting: StoreSearch { } } -class StoreSearchSpec: QuickSpec { - override func spec() { +public class StoreSearchSpec: QuickSpec { + public override func spec() { let storeSearch = StoreSearchForTesting() describe("url string") { diff --git a/Tests/MasKitTests/ExternalCommands/OpenSystemCommandSpec.swift b/Tests/MasKitTests/ExternalCommands/OpenSystemCommandSpec.swift index c8a24dc..b3d31d5 100644 --- a/Tests/MasKitTests/ExternalCommands/OpenSystemCommandSpec.swift +++ b/Tests/MasKitTests/ExternalCommands/OpenSystemCommandSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class OpenSystemCommandSpec: QuickSpec { - override func spec() { +public class OpenSystemCommandSpec: QuickSpec { + public override func spec() { describe("open system command") { context("binary path") { it("defaults to the macOS open command") { diff --git a/Tests/MasKitTests/Formatters/AppListFormatterSpec.swift b/Tests/MasKitTests/Formatters/AppListFormatterSpec.swift index de0a9c1..913cd2d 100644 --- a/Tests/MasKitTests/Formatters/AppListFormatterSpec.swift +++ b/Tests/MasKitTests/Formatters/AppListFormatterSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class AppListsFormatterSpec: QuickSpec { - override func spec() { +public class AppListsFormatterSpec: QuickSpec { + public override 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 c83fc66..90ab429 100644 --- a/Tests/MasKitTests/Formatters/SearchResultFormatterSpec.swift +++ b/Tests/MasKitTests/Formatters/SearchResultFormatterSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class SearchResultsFormatterSpec: QuickSpec { - override func spec() { +public class SearchResultsFormatterSpec: QuickSpec { + public override 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 14e90f2..e6bfd0b 100644 --- a/Tests/MasKitTests/Models/SearchResultListSpec.swift +++ b/Tests/MasKitTests/Models/SearchResultListSpec.swift @@ -12,8 +12,8 @@ import Quick @testable import MasKit -class SearchResultListSpec: QuickSpec { - override func spec() { +public class SearchResultListSpec: QuickSpec { + public override func spec() { describe("search result list") { it("can parse bbedit") { let data = Data(from: "search/bbedit.json") diff --git a/Tests/MasKitTests/Models/SearchResultSpec.swift b/Tests/MasKitTests/Models/SearchResultSpec.swift index 16d69d2..12d4107 100644 --- a/Tests/MasKitTests/Models/SearchResultSpec.swift +++ b/Tests/MasKitTests/Models/SearchResultSpec.swift @@ -12,8 +12,8 @@ import Quick @testable import MasKit -class SearchResultSpec: QuickSpec { - override func spec() { +public class SearchResultSpec: QuickSpec { + public override func spec() { describe("search result") { it("can parse things") { let data = Data(from: "search/things-that-go-bump.json") diff --git a/Tests/MasKitTests/Network/NetworkSessionMock.swift b/Tests/MasKitTests/Network/NetworkSessionMock.swift index 76556b7..8bd8408 100644 --- a/Tests/MasKitTests/Network/NetworkSessionMock.swift +++ b/Tests/MasKitTests/Network/NetworkSessionMock.swift @@ -12,8 +12,6 @@ import Foundation /// Mock NetworkSession for testing. class NetworkSessionMock: NetworkSession { - typealias CompletionHandler = (Data?, URLResponse?, Error?) -> Void - // Properties that enable us to set exactly what data or error // we want our mocked URLSession to return for any request. var data: Data? diff --git a/Tests/MasKitTests/OutputListenerSpec.swift b/Tests/MasKitTests/OutputListenerSpec.swift index 95a6e01..fd92e85 100644 --- a/Tests/MasKitTests/OutputListenerSpec.swift +++ b/Tests/MasKitTests/OutputListenerSpec.swift @@ -11,8 +11,8 @@ import Quick @testable import MasKit -class OutputListenerSpec: QuickSpec { - override func spec() { +public class OutputListenerSpec: QuickSpec { + public override func spec() { describe("output listener") { it("can intercept a single line written stdout") { let output = OutputListener() diff --git a/script/lint b/script/lint index 21adf4d..e983412 100755 --- a/script/lint +++ b/script/lint @@ -12,7 +12,7 @@ echo "==> 🚨 Linting mas" -for LINTER in git markdownlint shfmt swiftformat swiftlint; do +for LINTER in git markdownlint periphery shfmt swiftformat swiftlint; do if [[ ! -x "$(command -v ${LINTER})" ]]; then echo "error: ${LINTER} is not installed. Run 'script/bootstrap' or 'brew install ${LINTER}'." exit 1 @@ -33,6 +33,7 @@ for SOURCE in Package.swift Sources Tests; do swift run swift-format lint --recursive ${SOURCE} swiftlint lint --strict ${SOURCE} done +periphery scan --retain-public --strict echo echo "--> 📜 Bash"