Skip to content

Commit 30c5fa5

Browse files
authored
⚠️ Cleaning up Swiftlint warnings (#1022)
1 parent 8836db5 commit 30c5fa5

18 files changed

+158
-130
lines changed

Amplify/Categories/DataStore/Model/Internal/Embedded.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import Foundation
1313
/// `embedded(type:)` or `embeddedCollection(of:)` must comform to the `Embeddable` protocol except for Swift's Basic
1414
/// types embedded as a collection. A collection of String can be embedded in the `Model` as
1515
/// `embeddedCollection(of: String.self)` without needing to conform to Embeddable.
16-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
17-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
18-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
19-
///
16+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
17+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
18+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
19+
/// breaking change.
2020
public protocol Embeddable: Codable {
2121

2222
/// A reference to the `ModelSchema` associated with this embedded type.

Amplify/Categories/DataStore/Model/Internal/Model+Array.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import Foundation
99

1010
extension Array where Element: Model {
1111

12-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
13-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
14-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
12+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
13+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
14+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
15+
/// breaking change.
1516
public func unique() throws -> Element? {
1617
guard (0 ... 1).contains(count) else {
1718
throw DataStoreError.nonUniqueResult(model: Element.modelName, count: count)
@@ -22,9 +23,10 @@ extension Array where Element: Model {
2223

2324
extension Array where Element == Model {
2425

25-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
26-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
27-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
26+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
27+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
28+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
29+
/// breaking change.
2830
public func unique() throws -> Element? {
2931
guard (0 ... 1).contains(count) else {
3032
let firstModelName = self[0].modelName

Amplify/Categories/DataStore/Model/Internal/Model+Codable.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ extension Model where Self: Codable {
2020
/// - Returns: an instance of the concrete type conforming to `Model`
2121
/// - Throws: `DecodingError.dataCorrupted` in case data is not a valid JSON or any
2222
/// other decoding specific error that `JSONDecoder.decode()` might throw.
23-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
24-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
25-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
23+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
24+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
25+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
26+
/// breaking change.
2627
public static func from(json: String,
2728
decoder: JSONDecoder? = nil) throws -> Self {
2829
let resolvedDecoder: JSONDecoder
@@ -49,9 +50,10 @@ extension Model where Self: Codable {
4950
/// - Returns: an instance of the concrete type conforming to `Model`
5051
/// - Throws: `DecodingError.dataCorrupted` in case data is not a valid JSON or any
5152
/// other decoding specific error that `JSONDecoder.decode()` might throw.
52-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
53-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
54-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
53+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
54+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
55+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
56+
/// breaking change.
5557
public static func from(dictionary: [String: Any]) throws -> Self {
5658
let data = try JSONSerialization.data(withJSONObject: dictionary)
5759
let decoder = JSONDecoder(dateDecodingStrategy: ModelDateFormatting.decodingStrategy)
@@ -64,9 +66,10 @@ extension Model where Self: Codable {
6466
/// custom date formatter that encodes ISO8601 dates with fractional seconds
6567
/// - Returns: the JSON representation of the `Model`
6668
/// - seealso: https://developer.apple.com/documentation/foundation/jsonencoder/2895034-encode
67-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
68-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
69-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
69+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
70+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
71+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
72+
/// breaking change.
7073
public func toJSON(encoder: JSONEncoder? = nil) throws -> String {
7174
let resolvedEncoder: JSONEncoder
7275
if let encoder = encoder {

Amplify/Categories/DataStore/Model/Internal/Model+DateFormatting.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88
import Foundation
99

10-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
11-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
12-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
10+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
11+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
12+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
13+
/// breaking change.
1314
public struct ModelDateFormatting {
1415

1516
public static let decodingStrategy: JSONDecoder.DateDecodingStrategy = {
@@ -35,9 +36,10 @@ public struct ModelDateFormatting {
3536

3637
public extension JSONDecoder {
3738

38-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
39-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
40-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
39+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
40+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
41+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
42+
/// breaking change.
4143
convenience init(dateDecodingStrategy: JSONDecoder.DateDecodingStrategy) {
4244
self.init()
4345
self.dateDecodingStrategy = dateDecodingStrategy
@@ -46,9 +48,10 @@ public extension JSONDecoder {
4648

4749
public extension JSONEncoder {
4850

49-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
50-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
51-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
51+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
52+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
53+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
54+
/// breaking change.
5255
convenience init(dateEncodingStrategy: JSONEncoder.DateEncodingStrategy) {
5356
self.init()
5457
self.dateEncodingStrategy = dateEncodingStrategy

Amplify/Categories/DataStore/Model/Internal/Model+Subscript.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
/// ```
1313
extension Model {
1414

15-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
16-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
17-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
15+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
16+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
17+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
18+
/// breaking change.
1819
public subscript(_ key: String) -> Any?? {
1920

2021
if let jsonModel = self as? JSONValueHolder {

Amplify/Categories/DataStore/Model/Internal/ModelRegistry+Syncable.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88
public extension ModelRegistry {
99

10-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
11-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
12-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
10+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
11+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
12+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
13+
/// breaking change.
1314
static var hasSyncableModels: Bool {
1415
if #available(iOS 13.0, *) {
1516
return modelSchemas.contains { !$0.isSystem }

Amplify/Categories/DataStore/Model/Internal/Persistable.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ struct PersistableHelper {
4242
/// - lhs: a reference to a Persistable object
4343
/// - rhs: another reference
4444
/// - Returns: `true` in case both values are equal or `false` otherwise
45-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
46-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
47-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
45+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
46+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
47+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
48+
/// breaking change.
4849
public static func isEqual(_ lhs: Persistable?, _ rhs: Persistable?) -> Bool {
4950
if lhs == nil && rhs == nil {
5051
return true
@@ -69,7 +70,7 @@ struct PersistableHelper {
6970
}
7071
}
7172

72-
//We are promoting Int to Double in the case where we are comparing these two types
73+
// We are promoting Int to Double in the case where we are comparing these two types
7374
public static func isEqual(_ lhs: Any?, _ rhs: Persistable?) -> Bool {
7475
if lhs == nil && rhs == nil {
7576
return true
@@ -98,13 +99,13 @@ struct PersistableHelper {
9899
}
99100
}
100101

101-
//We are promoting Int to Double in the case where we are comparing these two types
102+
// We are promoting Int to Double in the case where we are comparing these two types
102103
public static func isLessOrEqual(_ lhs: Any?, _ rhs: Persistable?) -> Bool {
103104
if lhs == nil && rhs == nil {
104105
return true
105106
}
106107
switch (lhs, rhs) {
107-
//case Bool Removed
108+
// case Bool Removed
108109
case let (lhs, rhs) as (Temporal.Date, Temporal.Date):
109110
return lhs <= rhs
110111
case let (lhs, rhs) as (Temporal.DateTime, Temporal.DateTime):
@@ -126,13 +127,13 @@ struct PersistableHelper {
126127
}
127128
}
128129

129-
//We are promoting Int to Double in the case where we are comparing these two types
130+
// We are promoting Int to Double in the case where we are comparing these two types
130131
public static func isLessThan(_ lhs: Any?, _ rhs: Persistable?) -> Bool {
131132
if lhs == nil && rhs == nil {
132133
return false
133134
}
134135
switch (lhs, rhs) {
135-
//case Bool Removed
136+
// case Bool Removed
136137
case let (lhs, rhs) as (Temporal.Date, Temporal.Date):
137138
return lhs < rhs
138139
case let (lhs, rhs) as (Temporal.DateTime, Temporal.DateTime):
@@ -154,13 +155,13 @@ struct PersistableHelper {
154155
}
155156
}
156157

157-
//We are promoting Int to Double in the case where we are comparing these two types
158+
// We are promoting Int to Double in the case where we are comparing these two types
158159
public static func isGreaterOrEqual(_ lhs: Any?, _ rhs: Persistable?) -> Bool {
159160
if lhs == nil && rhs == nil {
160161
return true
161162
}
162163
switch (lhs, rhs) {
163-
//case Bool Removed
164+
// case Bool Removed
164165
case let (lhs, rhs) as (Temporal.Date, Temporal.Date):
165166
return lhs >= rhs
166167
case let (lhs, rhs) as (Temporal.DateTime, Temporal.DateTime):
@@ -182,13 +183,13 @@ struct PersistableHelper {
182183
}
183184
}
184185

185-
//We are promoting Int to Double in the case where we are comparing these two types
186+
// We are promoting Int to Double in the case where we are comparing these two types
186187
public static func isGreaterThan(_ lhs: Any?, _ rhs: Persistable?) -> Bool {
187188
if lhs == nil && rhs == nil {
188189
return false
189190
}
190191
switch (lhs, rhs) {
191-
//case Bool Removed
192+
// case Bool Removed
192193
case let (lhs, rhs) as (Temporal.Date, Temporal.Date):
193194
return lhs > rhs
194195
case let (lhs, rhs) as (Temporal.DateTime, Temporal.DateTime):

Amplify/Categories/DataStore/Model/Internal/Schema/Model+Schema.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ import Foundation
99

1010
extension Model {
1111

12-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
13-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
14-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
12+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
13+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
14+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
15+
/// breaking change.
1516
public static var schema: ModelSchema {
1617
// TODO load schema from JSON when this it not overridden by specific models
1718
ModelSchema(name: modelName, fields: [:])
1819
}
1920

20-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
21-
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
22-
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
21+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
22+
/// directly by host applications. The behavior of this may change without warning. Though it is not used by host
23+
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
24+
/// breaking change.
2325
public var schema: ModelSchema {
2426
type(of: self).schema
2527
}
@@ -42,8 +44,8 @@ extension Model {
4244
/// - attributes: model attributes (aka "directives" or "annotations")
4345
/// - define: the closure used to define the model attributes and fields
4446
/// - Returns: a valid `ModelSchema` instance
45-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
46-
/// by host applications. The behavior of this may change without warning.
47+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
48+
/// directly by host applications. The behavior of this may change without warning.
4749
public static func defineSchema(name: String? = nil,
4850
attributes: ModelAttribute...,
4951
define: (inout ModelSchemaDefinition) -> Void) -> ModelSchema {
@@ -53,8 +55,8 @@ extension Model {
5355
return definition.build()
5456
}
5557

56-
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
57-
/// by host applications. The behavior of this may change without warning.
58+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
59+
/// directly by host applications. The behavior of this may change without warning.
5860
public static func rule(allow: AuthStrategy,
5961
ownerField: String? = nil,
6062
identityClaim: String? = nil,

0 commit comments

Comments
 (0)