Skip to content

Instantly share code, notes, and snippets.

@noahsark769
Created August 21, 2020 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahsark769/d3cbb85c4bd81cbf6b169f715d11e0bf to your computer and use it in GitHub Desktop.
Save noahsark769/d3cbb85c4bd81cbf6b169f715d11e0bf to your computer and use it in GitHub Desktop.
multiline_arguments_parameters false positives
expect(issue.createdAt).to(equal(
Helper.date(["$date": NSNumber(value: value1)])
))
expect(followers).to(containExactUnorderedElements([
Follower(
followerUid: "a",
followerType: .group
),
Follower(
followerUid: "b",
followerType: .user
),
]))
expect(
Table.statement(forSpecialFTSCommand: "rebuild").prepare().0
).to(equal(
"INSERT INTO table(fts_index) VALUES('rebuild')"
))
expect(changes.filter {
guard case let .delete(_, type) = $0 else { return false }
return modelType is SetModel.Type
}).to(haveCount(1))
expect(a?.uids).to(equal(
[
"07262910-DF29-465C-9DE8-2FB81BA50938",
"B4297AB8-6766-4EAA-BF95-F9CF4B95C7AA",
"0665EF65-3DA8-464E-B49C-B88F9FD1AED3",
]
))
expect(uidsAndTags).to(containExactUnorderedElements([
("0c40e99f-4391-41f9-b91a-3ce389694264", "asdfasdf"),
("bae31c74-e647-4a33-9eb9-9980c81aaf8f", "fdsaadfs"),
("c40c7d92-18fa-4fb9-b73b-d2435859f31f", "dfssdfad"),
("aaeba695-9246-4cd6-9920-1c8616a05cbc", "dssdfadd"),
("238cd085-7c89-4704-b171-67a0b32dbdd5", "adsfafsd"),
].map(TwoTuple.init)))
try context.context.update(Update(
Table.self,
[(Table.Columns.nextUid, nil)],
whereClause: Table.Columns.next != nil
))
guard let maxResult = (try self.database.context.queryOne(
Statement(text: "SELECT MAX(ROWID) FROM \(Table.name)")
) { $0.currentRow[0] as Int64? }), let maxRowId = maxResult else {
// no data
return
}
guard let model = try self.queryOne(Select(
Table.self,
whereClause: (
Table.Columns.uid == Where.param(uid) &&
Table.Columns.project == Where.param(self.context.project)
)
)) else {
// Example
throw Errors.addingToNonexistent
}
models.append(Model(
modelUid: self.modelUid,
otherUid: key.stringValue,
tertiaryUid: metadata.uid,
quaternaryUid: metadata.uid,
status: Model.Status(rawValue: metadata.status ?? "") ?? .success
))
completion(.failure(.requestPreparationError(
request: URLRequest(url: self._requestUrl(for: project, service: service)),
error: error,
type: .unknown
)))
public func toDictionary<K, V>(_ transform: (Iterator.Element) -> (K, V)) -> [K: V] {
return [K: V](
self.map(transform)
) { _, last in last }
}
@objc public dynamic var customServices: [Service] {
return Array(self.records.values.sorted(by: { first, second -> Bool in
first.name < second.name
}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment