🧹 Lint

This commit is contained in:
Chris Araman 2021-03-28 17:30:55 -07:00
parent 5df8db3fd6
commit e65365d25f
No known key found for this signature in database
GPG key ID: BB4499D9E11B61E0
6 changed files with 23 additions and 24 deletions

View file

@ -10,6 +10,7 @@
# Disabled rules
--disable blankLinesAroundMark
--disable consecutiveSpaces
--disable hoistPatternLet
--disable indent
# Enabled rules (disabled by default)

View file

@ -19,23 +19,21 @@ public struct ResetCommand: CommandProtocol {
/// Runs the command.
public func run(_ options: Options) -> Result<Void, MASError> {
/*
The "Reset Application" command in the Mac App Store debug menu performs
the following steps
- killall Dock
- killall storeagent (storeagent no longer exists)
- rm com.apple.appstore download directory
- clear cookies (appears to be a no-op)
As storeagent no longer exists we will implement a slight variant and kill all
App Store-associated processes
- storeaccountd
- storeassetd
- storedownloadd
- storeinstalld
- storelegacy
*/
// The "Reset Application" command in the Mac App Store debug menu performs
// the following steps
//
// - killall Dock
// - killall storeagent (storeagent no longer exists)
// - rm com.apple.appstore download directory
// - clear cookies (appears to be a no-op)
//
// As storeagent no longer exists we will implement a slight variant and kill all
// App Store-associated processes
// - storeaccountd
// - storeassetd
// - storedownloadd
// - storeinstalld
// - storelegacy
// Kill processes
let killProcs = [

View file

@ -28,7 +28,7 @@ extension StoreSearch {
/// - Parameter appName: Name of app to find.
/// - Returns: String URL for the search service or nil if appName can't be encoded.
func searchURLString(forApp appName: String) -> String? {
if let urlEncodedAppName = appName.URLEncodedString {
if let urlEncodedAppName = appName.urlEncodedString {
return "https://itunes.apple.com/search?media=software&entity=macSoftware&term=\(urlEncodedAppName)"
}
return nil

View file

@ -46,7 +46,7 @@ extension MASError: CustomStringConvertible {
https://github.com/mas-cli/mas/issues/164
"""
case let .signInFailed(error):
case .signInFailed(let error):
if let error = error {
return "Sign in failed: \(error.localizedDescription)"
} else {
@ -56,14 +56,14 @@ extension MASError: CustomStringConvertible {
case .alreadySignedIn:
return "Already signed in"
case let .purchaseFailed(error):
case .purchaseFailed(let error):
if let error = error {
return "Download request failed: \(error.localizedDescription)"
} else {
return "Download request failed"
}
case let .downloadFailed(error):
case .downloadFailed(let error):
if let error = error {
return "Download failed: \(error.localizedDescription)"
} else {

View file

@ -10,7 +10,7 @@ import Foundation
extension String {
/// Return an URL encoded string
public var URLEncodedString: String? {
public var urlEncodedString: String? {
addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
}
}

View file

@ -14,10 +14,10 @@ enum NetworkResult {
extension NetworkResult: Equatable {
static func == (lhs: NetworkResult, rhs: NetworkResult) -> Bool {
switch (lhs, rhs) {
case let (.success(data1), .success(data2)):
case (.success(let data1), .success(let data2)):
return data1 == data2
case let (.failure(error1), .failure(error2)):
case (.failure(let error1), .failure(let error2)):
return error1.localizedDescription == error2.localizedDescription
default: