Fix lint issues.
This commit is contained in:
parent
03e9bbff34
commit
962d5fa45c
@ -9,13 +9,13 @@ let package = Package(
|
|||||||
.library(
|
.library(
|
||||||
name: "ArticlesDatabase",
|
name: "ArticlesDatabase",
|
||||||
type: .dynamic,
|
type: .dynamic,
|
||||||
targets: ["ArticlesDatabase"]),
|
targets: ["ArticlesDatabase"])
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(path: "../RSDatabase"),
|
.package(path: "../RSDatabase"),
|
||||||
.package(path: "../Parser"),
|
.package(path: "../Parser"),
|
||||||
.package(path: "../RSCore"),
|
.package(path: "../RSCore"),
|
||||||
.package(path: "../Articles"),
|
.package(path: "../Articles")
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(
|
||||||
@ -24,9 +24,9 @@ let package = Package(
|
|||||||
"RSCore",
|
"RSCore",
|
||||||
"RSDatabase",
|
"RSDatabase",
|
||||||
"Parser",
|
"Parser",
|
||||||
"Articles",
|
"Articles"
|
||||||
],
|
],
|
||||||
swiftSettings: [.unsafeFlags(["-warnings-as-errors"])]
|
swiftSettings: [.unsafeFlags(["-warnings-as-errors"])]
|
||||||
),
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -112,7 +112,7 @@ final class ArticlesTable: DatabaseTable {
|
|||||||
|
|
||||||
func fetchArticlesMatching(_ searchString: String) throws -> Set<Article> {
|
func fetchArticlesMatching(_ searchString: String) throws -> Set<Article> {
|
||||||
var articles: Set<Article> = Set<Article>()
|
var articles: Set<Article> = Set<Article>()
|
||||||
var error: DatabaseError? = nil
|
var error: DatabaseError?
|
||||||
|
|
||||||
queue.runInDatabaseSync { (databaseResult) in
|
queue.runInDatabaseSync { (databaseResult) in
|
||||||
switch databaseResult {
|
switch databaseResult {
|
||||||
@ -182,7 +182,7 @@ final class ArticlesTable: DatabaseTable {
|
|||||||
let authorsNames = row.string(forColumn: DatabaseKey.authors)
|
let authorsNames = row.string(forColumn: DatabaseKey.authors)
|
||||||
|
|
||||||
let searchRowIDObject = row.object(forColumnName: DatabaseKey.searchRowID)
|
let searchRowIDObject = row.object(forColumnName: DatabaseKey.searchRowID)
|
||||||
var searchRowID: Int? = nil
|
var searchRowID: Int?
|
||||||
if searchRowIDObject != nil && !(searchRowIDObject is NSNull) {
|
if searchRowIDObject != nil && !(searchRowIDObject is NSNull) {
|
||||||
searchRowID = Int(row.longLongInt(forColumn: DatabaseKey.searchRowID))
|
searchRowID = Int(row.longLongInt(forColumn: DatabaseKey.searchRowID))
|
||||||
}
|
}
|
||||||
@ -492,7 +492,7 @@ final class ArticlesTable: DatabaseTable {
|
|||||||
queue.runInTransaction { databaseResult in
|
queue.runInTransaction { databaseResult in
|
||||||
switch databaseResult {
|
switch databaseResult {
|
||||||
case .success(let database):
|
case .success(let database):
|
||||||
let _ = self.statusesTable.ensureStatusesForArticleIDs(articleIDs, true, database)
|
_ = self.statusesTable.ensureStatusesForArticleIDs(articleIDs, true, database)
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
completion(nil)
|
completion(nil)
|
||||||
}
|
}
|
||||||
@ -645,7 +645,7 @@ private extension ArticlesTable {
|
|||||||
|
|
||||||
private func fetchArticles(_ fetchMethod: @escaping ArticlesFetchMethod) throws -> Set<Article> {
|
private func fetchArticles(_ fetchMethod: @escaping ArticlesFetchMethod) throws -> Set<Article> {
|
||||||
var articles = Set<Article>()
|
var articles = Set<Article>()
|
||||||
var error: DatabaseError? = nil
|
var error: DatabaseError?
|
||||||
queue.runInDatabaseSync { databaseResult in
|
queue.runInDatabaseSync { databaseResult in
|
||||||
switch databaseResult {
|
switch databaseResult {
|
||||||
case .success(let database):
|
case .success(let database):
|
||||||
@ -662,7 +662,7 @@ private extension ArticlesTable {
|
|||||||
|
|
||||||
private func fetchArticlesCount(_ fetchMethod: @escaping ArticlesCountFetchMethod) throws -> Int {
|
private func fetchArticlesCount(_ fetchMethod: @escaping ArticlesCountFetchMethod) throws -> Int {
|
||||||
var articlesCount = 0
|
var articlesCount = 0
|
||||||
var error: DatabaseError? = nil
|
var error: DatabaseError?
|
||||||
queue.runInDatabaseSync { databaseResult in
|
queue.runInDatabaseSync { databaseResult in
|
||||||
switch databaseResult {
|
switch databaseResult {
|
||||||
case .success(let database):
|
case .success(let database):
|
||||||
@ -784,7 +784,7 @@ private extension ArticlesTable {
|
|||||||
|
|
||||||
func sqliteSearchString(with searchString: String) -> String {
|
func sqliteSearchString(with searchString: String) -> String {
|
||||||
var s = ""
|
var s = ""
|
||||||
searchString.enumerateSubstrings(in: searchString.startIndex..<searchString.endIndex, options: .byWords) { (word, range, enclosingRange, stop) in
|
searchString.enumerateSubstrings(in: searchString.startIndex..<searchString.endIndex, options: .byWords) { (word, _, _, _) in
|
||||||
guard let word = word else {
|
guard let word = word else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -940,7 +940,7 @@ private extension ArticlesTable {
|
|||||||
if let fetchedArticle = fetchedArticles[updatedArticle.articleID] {
|
if let fetchedArticle = fetchedArticles[updatedArticle.articleID] {
|
||||||
return updatedArticle[keyPath: comparisonKeyPath] != fetchedArticle[keyPath: comparisonKeyPath]
|
return updatedArticle[keyPath: comparisonKeyPath] != fetchedArticle[keyPath: comparisonKeyPath]
|
||||||
}
|
}
|
||||||
assertionFailure("Expected to find matching fetched article.");
|
assertionFailure("Expected to find matching fetched article.")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -977,7 +977,6 @@ private extension ArticlesTable {
|
|||||||
return updatedArticles
|
return updatedArticles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func saveUpdatedArticles(_ updatedArticles: Set<Article>, _ fetchedArticles: [String: Article], _ database: FMDatabase) {
|
func saveUpdatedArticles(_ updatedArticles: Set<Article>, _ fetchedArticles: [String: Article], _ database: FMDatabase) {
|
||||||
saveUpdatedRelatedObjects(updatedArticles, fetchedArticles, database)
|
saveUpdatedRelatedObjects(updatedArticles, fetchedArticles, database)
|
||||||
|
|
||||||
@ -991,7 +990,7 @@ private extension ArticlesTable {
|
|||||||
// Untested theory: this gets us better performance and less database fragmentation.
|
// Untested theory: this gets us better performance and less database fragmentation.
|
||||||
|
|
||||||
guard let fetchedArticle = fetchedArticles[updatedArticle.articleID] else {
|
guard let fetchedArticle = fetchedArticles[updatedArticle.articleID] else {
|
||||||
assertionFailure("Expected to find matching fetched article.");
|
assertionFailure("Expected to find matching fetched article.")
|
||||||
saveNewArticles(Set([updatedArticle]), database)
|
saveNewArticles(Set([updatedArticle]), database)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ import Articles
|
|||||||
// CREATE TABLE if not EXISTS authors (authorID TEXT NOT NULL PRIMARY KEY, name TEXT, url TEXT, avatarURL TEXT, emailAddress TEXT);
|
// CREATE TABLE if not EXISTS authors (authorID TEXT NOT NULL PRIMARY KEY, name TEXT, url TEXT, avatarURL TEXT, emailAddress TEXT);
|
||||||
// CREATE TABLE if not EXISTS authorLookup (authorID TEXT NOT NULL, articleID TEXT NOT NULL, PRIMARY KEY(authorID, articleID));
|
// CREATE TABLE if not EXISTS authorLookup (authorID TEXT NOT NULL, articleID TEXT NOT NULL, PRIMARY KEY(authorID, articleID));
|
||||||
|
|
||||||
|
|
||||||
final class AuthorsTable: DatabaseRelatedObjectsTable {
|
final class AuthorsTable: DatabaseRelatedObjectsTable {
|
||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
@ -37,4 +36,3 @@ final class AuthorsTable: DatabaseRelatedObjectsTable {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,4 +32,3 @@ extension ArticleStatus: @retroactive DatabaseObject {
|
|||||||
return [DatabaseKey.articleID: articleID, DatabaseKey.read: read, DatabaseKey.starred: starred, DatabaseKey.dateArrived: dateArrived]
|
return [DatabaseKey.articleID: articleID, DatabaseKey.read: read, DatabaseKey.starred: starred, DatabaseKey.dateArrived: dateArrived]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,4 +63,3 @@ extension Author: @retroactive DatabaseObject {
|
|||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +158,7 @@ final class StatusesTable: DatabaseTable {
|
|||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
completion(.failure(error))
|
completion(.failure(error))
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
completion(.success(articleIDs))
|
completion(.success(articleIDs))
|
||||||
}
|
}
|
||||||
@ -316,5 +315,3 @@ private final class StatusCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user