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