Enable SwiftLint rule 'trailing_closure' and fix all violations
This commit is contained in:
parent
937019d6e8
commit
0317f5a83b
5 changed files with 6 additions and 6 deletions
|
|
@ -163,7 +163,7 @@ whitelist_rules:
|
|||
- syntactic_sugar
|
||||
- todo
|
||||
- toggle_bool
|
||||
# - trailing_closure
|
||||
- trailing_closure
|
||||
# - trailing_comma
|
||||
- trailing_newline
|
||||
- trailing_semicolon
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ struct GopenPGPInterface: PGPInterface {
|
|||
}
|
||||
|
||||
func containsPublicKey(with keyID: String) -> Bool {
|
||||
publicKeys.keys.contains(where: { key in key.hasSuffix(keyID.lowercased()) })
|
||||
publicKeys.keys.contains { key in key.hasSuffix(keyID.lowercased()) }
|
||||
}
|
||||
|
||||
func containsPrivateKey(with keyID: String) -> Bool {
|
||||
privateKeys.keys.contains(where: { key in key.hasSuffix(keyID.lowercased()) })
|
||||
privateKeys.keys.contains { key in key.hasSuffix(keyID.lowercased()) }
|
||||
}
|
||||
|
||||
func decrypt(encryptedData: Data, keyID: String, passphrase: String) throws -> Data? {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public enum AppError: Error, Equatable {
|
|||
|
||||
extension AppError: LocalizedError {
|
||||
public var errorDescription: String? {
|
||||
let localizationKey = "\(String(describing: self).prefix(while: { $0 != "(" }))Error."
|
||||
let localizationKey = "\(String(describing: self).prefix { $0 != "(" })Error."
|
||||
switch self {
|
||||
case let .RepositoryRemoteBranchNotFound(name), let .RepositoryBranchNotFound(name), let .ReadingFile(name):
|
||||
return localizationKey.localize(name)
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class Password {
|
|||
|
||||
private func getAdditionValue(withKey key: String, caseSensitive: Bool = false) -> String? {
|
||||
let toLowercase = { (string: String) -> String in caseSensitive ? string : string.lowercased() }
|
||||
return additions.first(where: { toLowercase($0.title) == toLowercase(key) })?.content
|
||||
return additions.first { toLowercase($0.title) == toLowercase(key) }?.content
|
||||
}
|
||||
|
||||
/// Set the OTP token if we are able to construct a valid one.
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class PasswordGeneratorTest: XCTestCase {
|
|||
PasswordGenerator(flavor: .xkcd, length: 8, useSpecialSymbols: false),
|
||||
PasswordGenerator(flavor: .xkcd, length: 1, useSpecialSymbols: false),
|
||||
].forEach { generator in
|
||||
XCTAssertEqual(generator.generate().split(whereSeparator: { "0123456789".contains($0) }).count, generator.limitedLength)
|
||||
XCTAssertEqual(generator.generate().split { "0123456789".contains($0) }.count, generator.limitedLength)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue