Enable SwiftLint rule 'static_operator' and fix all violations

This commit is contained in:
Danny Moesch 2021-10-07 19:48:57 +02:00
parent 831ffe2235
commit b7e08dfb9e
3 changed files with 15 additions and 9 deletions

View file

@ -170,7 +170,7 @@ only_rules:
- sorted_first_last - sorted_first_last
# - sorted_imports # Managed by SwiftFormat. # - sorted_imports # Managed by SwiftFormat.
- statement_position - statement_position
# - static_operator - static_operator
- strict_fileprivate - strict_fileprivate
- strong_iboutlet - strong_iboutlet
- superfluous_disable_command - superfluous_disable_command

View file

@ -38,6 +38,9 @@ extension AdditionField {
} }
infix operator =>: MultiplicationPrecedence infix operator =>: MultiplicationPrecedence
public func => (key: String, value: String) -> AdditionField {
AdditionField(title: key, content: value) public extension String {
static func => (key: String, value: String) -> AdditionField {
AdditionField(title: key, content: value)
}
} }

View file

@ -50,11 +50,14 @@ func assertDefaults(
} }
infix operator : AdditionPrecedence infix operator : AdditionPrecedence
func (field: AdditionField, password: Password) -> Bool { // swiftlint:disable:this identifier_name
password.getFilteredAdditions().contains(field)
}
infix operator : AdditionPrecedence infix operator : AdditionPrecedence
func (field: AdditionField, password: Password) -> Bool { // swiftlint:disable:this identifier_name
!(field password) extension AdditionField {
static func (field: AdditionField, password: Password) -> Bool { // swiftlint:disable:this identifier_name
password.getFilteredAdditions().contains(field)
}
static func (field: AdditionField, password: Password) -> Bool { // swiftlint:disable:this identifier_name
!(field password)
}
} }