diff --git a/.swiftformat b/.swiftformat index 67558bf..90e7820 100644 --- a/.swiftformat +++ b/.swiftformat @@ -116,6 +116,10 @@ --elseposition same-line +### Empty braces: "no-space" (default), "spaced" or "linebreak" + +--emptybraces no-space + ### Case of 'e' in numbers: "lowercase" or "uppercase" (default) --exponentcase lowercase diff --git a/pass/Controllers/GitRepositorySettingsTableViewController.swift b/pass/Controllers/GitRepositorySettingsTableViewController.swift index 8985937..89b6ca5 100644 --- a/pass/Controllers/GitRepositorySettingsTableViewController.swift +++ b/pass/Controllers/GitRepositorySettingsTableViewController.swift @@ -130,7 +130,7 @@ class GitRepositorySettingsTableViewController: UITableViewController, PasswordA if let scheme = gitURL.scheme { switch scheme { case "http", "https", "ssh": - if gitURL.user == nil && usernameTextField.text == nil { + if gitURL.user == nil, usernameTextField.text == nil { Utils.alert(title: "CannotSave".localize(), message: "CannotFindUsername.".localize(), controller: self) return } diff --git a/pass/Controllers/PasswordEditorTableViewController.swift b/pass/Controllers/PasswordEditorTableViewController.swift index 77253d9..237a51f 100644 --- a/pass/Controllers/PasswordEditorTableViewController.swift +++ b/pass/Controllers/PasswordEditorTableViewController.swift @@ -371,7 +371,7 @@ class PasswordEditorTableViewController: UITableViewController { var previousPathLength = Int.max while passwordURL.path != "." { passwordURL = passwordURL.deletingLastPathComponent() - if passwordURL.path != "." && passwordURL.path.count >= previousPathLength { + if passwordURL.path != ".", passwordURL.path.count >= previousPathLength { Utils.alert(title: "CannotSave".localize(), message: "CannotParseFilename.".localize(), controller: self, completion: nil) return false } diff --git a/pass/Controllers/PasswordNavigationViewController.swift b/pass/Controllers/PasswordNavigationViewController.swift index 5f38f53..261860f 100644 --- a/pass/Controllers/PasswordNavigationViewController.swift +++ b/pass/Controllers/PasswordNavigationViewController.swift @@ -289,7 +289,7 @@ extension PasswordNavigationViewController { return false } } else if identifier == "addPasswordSegue" { - guard PGPAgent.shared.isPrepared && PasswordStore.shared.storeRepository != nil else { + guard PGPAgent.shared.isPrepared, PasswordStore.shared.storeRepository != nil else { Utils.alert(title: "CannotAddPassword".localize(), message: "MakeSurePgpAndGitProperlySet.".localize(), controller: self) return false } diff --git a/passKit/Helpers/KeyFileManager.swift b/passKit/Helpers/KeyFileManager.swift index b7c79fa..8ecd95e 100644 --- a/passKit/Helpers/KeyFileManager.swift +++ b/passKit/Helpers/KeyFileManager.swift @@ -34,7 +34,7 @@ public class KeyFileManager { } public func importKey(from string: String) throws { - guard string.unicodeScalars.allSatisfy({ $0.isASCII }) else { + guard string.unicodeScalars.allSatisfy(\.isASCII) else { throw AppError.encoding } keyHandler(string, keyType.getKeychainKey()) diff --git a/scripts/swiftformat.sh b/scripts/swiftformat.sh index 3996c71..be52e2a 100755 --- a/scripts/swiftformat.sh +++ b/scripts/swiftformat.sh @@ -1,4 +1,4 @@ -SWIFTFORMAT_VERSION="0.47.*" +SWIFTFORMAT_VERSION="0.48.*" if [[ "${CI}" == "true" ]]; then echo "Running in a Continuous Integration environment. Formatting is skipped."