Meta tweaks
This commit is contained in:
parent
03d5386e58
commit
957d80773f
|
@ -1,5 +1,7 @@
|
|||
only_rules:
|
||||
- accessibility_trait_for_button
|
||||
- array_init
|
||||
- blanket_disable_command
|
||||
- block_based_kvo
|
||||
- class_delegate_protocol
|
||||
- closing_brace
|
||||
|
@ -19,12 +21,15 @@ only_rules:
|
|||
- contains_over_range_nil_comparison
|
||||
- control_statement
|
||||
- custom_rules
|
||||
- deployment_target
|
||||
- direct_return
|
||||
- discarded_notification_center_observer
|
||||
- discouraged_assert
|
||||
- discouraged_direct_init
|
||||
- discouraged_none_name
|
||||
- discouraged_object_literal
|
||||
- discouraged_optional_collection
|
||||
- duplicate_conditions
|
||||
- duplicate_enum_cases
|
||||
- duplicate_imports
|
||||
- duplicated_key_in_dictionary_literal
|
||||
|
@ -50,7 +55,7 @@ only_rules:
|
|||
- implicit_getter
|
||||
- implicit_return
|
||||
- inclusive_language
|
||||
- inert_defer
|
||||
- invalid_swiftlint_command
|
||||
- is_disjoint
|
||||
- joined_default_parameter
|
||||
- last_where
|
||||
|
@ -66,7 +71,6 @@ only_rules:
|
|||
- lower_acl_than_parent
|
||||
- mark
|
||||
- modifier_order
|
||||
- multiline_arguments
|
||||
- multiline_function_chains
|
||||
- multiline_literal_brackets
|
||||
- multiline_parameters
|
||||
|
@ -76,12 +80,12 @@ only_rules:
|
|||
- no_fallthrough_only
|
||||
- no_space_in_method_call
|
||||
- notification_center_detachment
|
||||
- ns_number_init_as_function_reference
|
||||
- nsobject_prefer_isequal
|
||||
- number_separator
|
||||
- opening_brace
|
||||
- operator_usage_whitespace
|
||||
- operator_whitespace
|
||||
- orphaned_doc_comment
|
||||
- overridden_super_call
|
||||
- prefer_self_in_static_references
|
||||
- prefer_self_type_over_type_of_self
|
||||
|
@ -108,11 +112,13 @@ only_rules:
|
|||
- self_binding
|
||||
- self_in_property_initialization
|
||||
- shorthand_operator
|
||||
- shorthand_optional_binding
|
||||
- sorted_first_last
|
||||
- statement_position
|
||||
- static_operator
|
||||
- strong_iboutlet
|
||||
- superfluous_disable_command
|
||||
- superfluous_else
|
||||
- switch_case_alignment
|
||||
- switch_case_on_newline
|
||||
- syntactic_sugar
|
||||
|
@ -129,7 +135,6 @@ only_rules:
|
|||
- unneeded_parentheses_in_closure_argument
|
||||
- unowned_variable_capture
|
||||
- untyped_error_in_catch
|
||||
- unused_capture_list
|
||||
- unused_closure_parameter
|
||||
- unused_control_flow_label
|
||||
- unused_enumerated
|
||||
|
@ -142,12 +147,15 @@ only_rules:
|
|||
- void_function_in_ternary
|
||||
- void_return
|
||||
- xct_specific_matcher
|
||||
- xctfail_message
|
||||
- yoda_condition
|
||||
analyzer_rules:
|
||||
- capture_variable
|
||||
- unused_declaration
|
||||
- unused_import
|
||||
- typesafe_array_init
|
||||
for_where:
|
||||
allow_for_as_filter: true
|
||||
number_separator:
|
||||
minimum_length: 5
|
||||
identifier_name:
|
||||
|
@ -157,7 +165,6 @@ identifier_name:
|
|||
min_length:
|
||||
warning: 2
|
||||
error: 2
|
||||
validates_start_with_lowercase: false
|
||||
allowed_symbols:
|
||||
- '_'
|
||||
excluded:
|
||||
|
|
|
@ -422,9 +422,9 @@ extension Defaults {
|
|||
|
||||
if #available(macOS 12.0, macOSApplicationExtension 12.0, *) {
|
||||
return Value(cgColor: cgColor)
|
||||
} else {
|
||||
return Value(cgColor)
|
||||
}
|
||||
|
||||
return Value(cgColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ extension Defaults {
|
|||
) -> AnyPublisher<Void, Never> {
|
||||
let initial = Empty<Void, Never>(completeImmediately: false).eraseToAnyPublisher()
|
||||
|
||||
let combinedPublisher =
|
||||
return
|
||||
keys
|
||||
.map { key in
|
||||
DefaultsPublisher(suite: key.suite, key: key.name, options: options)
|
||||
|
@ -117,7 +117,5 @@ extension Defaults {
|
|||
.reduce(initial) { combined, keyPublisher in
|
||||
combined.merge(with: keyPublisher).eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
return combinedPublisher
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,10 @@ extension Defaults.Serializable {
|
|||
return anyObject
|
||||
}
|
||||
|
||||
guard let nextType = T.Serializable.self as? any Defaults.Serializable.Type, nextType != T.self else {
|
||||
guard
|
||||
let nextType = T.Serializable.self as? any Defaults.Serializable.Type,
|
||||
nextType != T.self
|
||||
else {
|
||||
// This is a special case for the types which do not conform to `Defaults.Serializable` (for example, `Any`).
|
||||
return T.bridge.deserialize(anyObject as? T.Serializable) as? T
|
||||
}
|
||||
|
|
|
@ -466,10 +466,10 @@ final class DefaultsAnySerializableTests: XCTestCase {
|
|||
|
||||
waitForExpectations(timeout: 10)
|
||||
}
|
||||
|
||||
|
||||
func testWrongCast() {
|
||||
let value = Defaults.AnySerializable(false)
|
||||
XCTAssertEqual(value.get(Bool.self), false)
|
||||
XCTAssertEqual(value.get(Bool.self), false) // swiftlint:disable:this xct_specific_matcher
|
||||
XCTAssertNil(value.get(String.self))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ final class DefaultsArrayTests: XCTestCase {
|
|||
.map { ($0.oldValue, $0.newValue) }
|
||||
.collect(3)
|
||||
|
||||
// swiftlint:disable discouraged_optional_collection
|
||||
// swiftlint:disable:next discouraged_optional_collection
|
||||
let expectedValues: [([String]?, [String]?)] = [(nil, fixtureArray), (fixtureArray, newName), (newName, nil)]
|
||||
|
||||
let cancellable = publisher.sink { actualValues in
|
||||
|
|
|
@ -99,7 +99,7 @@ final class DefaultsDictionaryTests: XCTestCase {
|
|||
.map { ($0.oldValue, $0.newValue) }
|
||||
.collect(3)
|
||||
|
||||
// swiftlint:disable discouraged_optional_collection
|
||||
// swiftlint:disable:next discouraged_optional_collection
|
||||
let expectedValues: [([String: String]?, [String: String]?)] = [(nil, fixtureDictionary), (fixtureDictionary, newName), (newName, nil)]
|
||||
|
||||
let cancellable = publisher.sink { actualValues in
|
||||
|
|
|
@ -317,7 +317,7 @@ final class DefaultsNSSecureCodingTests: XCTestCase {
|
|||
if counter == 2 {
|
||||
expect.fulfill()
|
||||
} else if counter > 2 {
|
||||
XCTFail()
|
||||
XCTFail() // swiftlint:disable:this xctfail_message
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,13 @@ extension CustomDate: Comparable {
|
|||
static func < (lhs: CustomDate, rhs: CustomDate) -> Bool {
|
||||
if lhs.year != rhs.year {
|
||||
return lhs.year < rhs.year
|
||||
} else if lhs.month != rhs.month {
|
||||
return lhs.month < rhs.month
|
||||
} else {
|
||||
return lhs.day < rhs.day
|
||||
}
|
||||
|
||||
if lhs.month != rhs.month {
|
||||
return lhs.month < rhs.month
|
||||
}
|
||||
|
||||
return lhs.day < rhs.day
|
||||
}
|
||||
|
||||
static func == (lhs: CustomDate, rhs: CustomDate) -> Bool {
|
||||
|
|
|
@ -48,15 +48,15 @@ struct DefaultsSetAlgebra<Element: Defaults.Serializable & Hashable>: SetAlgebra
|
|||
store.update(with: newMember)
|
||||
}
|
||||
|
||||
mutating func formUnion(_ other: DefaultsSetAlgebra) {
|
||||
mutating func formUnion(_ other: Self) {
|
||||
store.formUnion(other.store)
|
||||
}
|
||||
|
||||
mutating func formSymmetricDifference(_ other: DefaultsSetAlgebra) {
|
||||
mutating func formSymmetricDifference(_ other: Self) {
|
||||
store.formSymmetricDifference(other.store)
|
||||
}
|
||||
|
||||
mutating func formIntersection(_ other: DefaultsSetAlgebra) {
|
||||
mutating func formIntersection(_ other: Self) {
|
||||
store.formIntersection(other.store)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ final class DefaultsTests: XCTestCase {
|
|||
if counter == 2 {
|
||||
expect.fulfill()
|
||||
} else if counter > 2 {
|
||||
XCTFail()
|
||||
XCTFail() // swiftlint:disable:this xctfail_message
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -465,7 +465,7 @@ final class DefaultsTests: XCTestCase {
|
|||
}
|
||||
print("--- Main Thread: \(Thread.isMainThread)")
|
||||
if !Thread.isMainThread {
|
||||
XCTAssert(Defaults[key1]! == 4)
|
||||
XCTAssertEqual(Defaults[key1]!, 4)
|
||||
expect.fulfill()
|
||||
} else {
|
||||
usleep(300_000)
|
||||
|
@ -488,7 +488,7 @@ final class DefaultsTests: XCTestCase {
|
|||
let expect = expectation(description: "No infinite recursion")
|
||||
|
||||
let observation1 = Defaults.observe(key2, options: []) { _ in
|
||||
XCTFail()
|
||||
XCTFail() // swiftlint:disable:this xctfail_message
|
||||
}
|
||||
|
||||
let observation2 = Defaults.observe(keys: key1, key2, options: []) {
|
||||
|
@ -713,7 +713,7 @@ final class DefaultsTests: XCTestCase {
|
|||
sleep(1)
|
||||
|
||||
if index == 10 {
|
||||
XCTFail()
|
||||
XCTFail() // swiftlint:disable:this xctfail_message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ final class DefaultsTests: XCTestCase {
|
|||
Defaults[key] = true
|
||||
|
||||
guard let result = await waiter else {
|
||||
XCTFail()
|
||||
XCTFail() // swiftlint:disable:this xctfail_message
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue