Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SwiftLint config for 0.50.3 #161

Merged
merged 2 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Updated for 0.49.1
# Updated for 0.50.3

excluded:
- ".build"
Expand Down Expand Up @@ -97,6 +97,8 @@ opt_in_rules:
- accessibility_label_for_image
- comma_inheritance
- self_binding
- accessibility_trait_for_button
- shorthand_optional_binding

disabled_rules:
- trailing_comma
Expand Down
4 changes: 2 additions & 2 deletions Sources/Wealthsimple/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ struct Token {
credentialStorage: CredentialStorage,
completion: @escaping (Result<Self, TokenError>) -> Void
) {
guard let data = data else {
if let error = error {
guard let data else {
if let error {
completion(.failure(TokenError.httpError(error: error.localizedDescription)))
} else {
completion(.failure(TokenError.noDataReceived))
Expand Down
4 changes: 2 additions & 2 deletions Sources/Wealthsimple/WealthsimpleAccount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ struct WealthsimpleAccount: Account {
}

private static func handleResponse(data: Data?, response: URLResponse?, error: Error?, completion: @escaping (Result<[Account], AccountError>) -> Void) {
guard let data = data else {
if let error = error {
guard let data else {
if let error {
completion(.failure(AccountError.httpError(error: error.localizedDescription)))
} else {
completion(.failure(AccountError.noDataReceived))
Expand Down
8 changes: 4 additions & 4 deletions Sources/Wealthsimple/WealthsimpleDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public final class WealthsimpleDownloader {
/// Authneticates against the API. Call before calling any other method.
/// - Parameter completion: Gets an error in case something went wrong, otherwise nil
public func authenticate(completion: @escaping (Error?) -> Void) {
if let token = token {
if let token {
token.refreshIfNeeded {
switch $0 {
case .failure:
Expand Down Expand Up @@ -82,7 +82,7 @@ public final class WealthsimpleDownloader {
/// Get all Accounts the user has access to
/// - Parameter completion: Result with an array of `Account`s or an `Account.AccountError`
public func getAccounts(completion: @escaping (Result<[Account], AccountError>) -> Void) {
guard let token = token else {
guard let token else {
completion(.failure(.tokenError(.noToken)))
return
}
Expand All @@ -102,7 +102,7 @@ public final class WealthsimpleDownloader {
/// - date: Date of which the positions should be downloaded. If not date is provided, not date is sent to the API. The API falls back to the current date.
/// - completion: Result with an array of `Position`s or an `Position.PositionError`
public func getPositions(in account: Account, date: Date?, completion: @escaping (Result<[Position], PositionError>) -> Void) {
guard let token = token else {
guard let token else {
completion(.failure(.tokenError(.noToken)))
return
}
Expand All @@ -122,7 +122,7 @@ public final class WealthsimpleDownloader {
/// - startDate: Date from which the transactions are downloaded. If not date is provided, not date is sent to the API. The API falls back to 30 days ago from today.
/// - completion: Result with an array of `Transactions`s or an `Transactions.TransactionsError`
public func getTransactions(in account: Account, startDate: Date?, completion: @escaping (Result<[Transaction], TransactionError>) -> Void) {
guard let token = token else {
guard let token else {
completion(.failure(.tokenError(.noToken)))
return
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Wealthsimple/WealthsimplePosition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct WealthsimplePosition: Position {
URLQueryItem(name: "account_id", value: account.id),
URLQueryItem(name: "limit", value: "250")
]
if let date = date {
if let date {
url.queryItems?.append(URLQueryItem(name: "date", value: dateFormatter.string(from: date)))
}
var request = URLRequest(url: url.url!)
Expand All @@ -117,8 +117,8 @@ struct WealthsimplePosition: Position {
}

private static func handleResponse(data: Data?, response: URLResponse?, error: Error?, completion: @escaping (Result<[Position], PositionError>) -> Void) {
guard let data = data else {
if let error = error {
guard let data else {
if let error {
completion(.failure(PositionError.httpError(error: error.localizedDescription)))
} else {
completion(.failure(PositionError.noDataReceived))
Expand Down
4 changes: 2 additions & 2 deletions Sources/Wealthsimple/WealthsimpleTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ struct WealthsimpleTransaction: Transaction {
}

private static func handleResponse(data: Data?, response: URLResponse?, error: Error?, completion: @escaping (Result<[Transaction], TransactionError>) -> Void) {
guard let data = data else {
if let error = error {
guard let data else {
if let error {
completion(.failure(TransactionError.httpError(error: error.localizedDescription)))
} else {
completion(.failure(TransactionError.noDataReceived))
Expand Down