diff options
| author | Fuwn <[email protected]> | 2026-02-18 10:46:38 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-18 10:46:38 -0800 |
| commit | cd62bb58e1f32ddcccaac081dd9aec12c3edc398 (patch) | |
| tree | c7006dd094ed83fa84bafe48128129f016eccc89 /Sora | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-cd62bb58e1f32ddcccaac081dd9aec12c3edc398.tar.xz sora-testing-cd62bb58e1f32ddcccaac081dd9aec12c3edc398.zip | |
Fix SwiftLint violations
Diffstat (limited to 'Sora')
| -rw-r--r-- | Sora/Data/Booru/BooruManager.swift | 2 | ||||
| -rw-r--r-- | Sora/Data/JSONFileDocument.swift | 6 | ||||
| -rw-r--r-- | Sora/Data/Settings/SettingsManager.swift | 6 | ||||
| -rw-r--r-- | Sora/Views/FavoritesView.swift | 4 | ||||
| -rw-r--r-- | Sora/Views/Generic/GenericListView.swift | 4 | ||||
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridThumbnailView.swift | 2 | ||||
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridView.swift | 10 |
7 files changed, 16 insertions, 18 deletions
diff --git a/Sora/Data/Booru/BooruManager.swift b/Sora/Data/Booru/BooruManager.swift index 49b1be3..9b674da 100644 --- a/Sora/Data/Booru/BooruManager.swift +++ b/Sora/Data/Booru/BooruManager.swift @@ -202,7 +202,7 @@ class BooruManager: ObservableObject { // swiftlint:disable:this type_body_leng await fetchPosts(page: currentPage, tags: tags) - if historyIndex >= 0 && historyIndex < searchHistory.count { + if historyIndex >= 0, historyIndex < searchHistory.count { var currentQuery = searchHistory[historyIndex] currentQuery.page = currentPage diff --git a/Sora/Data/JSONFileDocument.swift b/Sora/Data/JSONFileDocument.swift index bc41616..5081fe3 100644 --- a/Sora/Data/JSONFileDocument.swift +++ b/Sora/Data/JSONFileDocument.swift @@ -6,7 +6,7 @@ struct JSONFileDocument: FileDocument { var data: Data - init(_ data: Data) throws { + init(_ data: Data) { self.data = data } @@ -18,9 +18,7 @@ struct JSONFileDocument: FileDocument { self.data = data } - func fileWrapper( - configuration: WriteConfiguration // swiftlint:disable:this unused_parameter - ) throws -> FileWrapper { + func fileWrapper(configuration _: WriteConfiguration) -> FileWrapper { FileWrapper(regularFileWithContents: data) } } diff --git a/Sora/Data/Settings/SettingsManager.swift b/Sora/Data/Settings/SettingsManager.swift index 8ab9bde..ed29ec3 100644 --- a/Sora/Data/Settings/SettingsManager.swift +++ b/Sora/Data/Settings/SettingsManager.swift @@ -303,7 +303,7 @@ class SettingsManager: ObservableObject { // swiftlint:disable:this type_body_l let value = extract(credentials) if let existing = dictionary[key] { - if isDefault(existing) && !isDefault(value) { + if isDefault(existing), !isDefault(value) { dictionary[key] = value } } else { @@ -769,8 +769,8 @@ class SettingsManager: ObservableObject { // swiftlint:disable:this type_body_l // MARK: Cache Loaders private func loadCache<T: Decodable & Sendable>( from data: Data, - sort: @escaping ([T]) -> [T], - assign: @escaping ([T]) -> Void + sort: ([T]) -> [T], + assign: ([T]) -> Void ) { let decoded = Self.decode([T].self, from: data) ?? [] let sorted = sort(decoded) diff --git a/Sora/Views/FavoritesView.swift b/Sora/Views/FavoritesView.swift index 3974215..7c41a2d 100644 --- a/Sora/Views/FavoritesView.swift +++ b/Sora/Views/FavoritesView.swift @@ -185,8 +185,8 @@ struct FavoritesView: View { // swiftlint:disable:this type_body_length #endif ScrollView { - if filteredFavorites.isEmpty - && (!searchText.isEmpty || !(selectedCollectionOption == .all)) + if filteredFavorites.isEmpty, + !searchText.isEmpty || selectedCollectionOption != .all { ContentUnavailableView( "No matching favorites found", diff --git a/Sora/Views/Generic/GenericListView.swift b/Sora/Views/Generic/GenericListView.swift index bf2a6aa..6c7ba3e 100644 --- a/Sora/Views/Generic/GenericListView.swift +++ b/Sora/Views/Generic/GenericListView.swift @@ -101,7 +101,7 @@ struct GenericListView<T: Identifiable & Hashable & GenericItem>: View { @ViewBuilder private var listContent: some View { List { - if filteredItems.isEmpty && (!searchText.isEmpty || !(selectedCollectionOption == .all)) { + if filteredItems.isEmpty, !searchText.isEmpty || selectedCollectionOption != .all { Text("No matching items found") .foregroundColor(.secondary) } @@ -143,7 +143,7 @@ struct GenericListView<T: Identifiable & Hashable & GenericItem>: View { ) } else { #if os(macOS) - if !settings.folders.isEmpty && !allowBookmarking { + if !settings.folders.isEmpty, !allowBookmarking { Picker("Sort", selection: $sort) { ForEach(SettingsBookmarkSort.allCases, id: \.rawValue) { sortMode in Text(sortMode.rawValue).tag(sortMode) diff --git a/Sora/Views/Post/Grid/PostGridThumbnailView.swift b/Sora/Views/Post/Grid/PostGridThumbnailView.swift index 313704b..5316731 100644 --- a/Sora/Views/Post/Grid/PostGridThumbnailView.swift +++ b/Sora/Views/Post/Grid/PostGridThumbnailView.swift @@ -62,7 +62,7 @@ struct PostGridThumbnailView: View { if #available(iOS 18.0, macOS 15.0, *) { imageContent(image: image) .onScrollVisibilityChange { visible in - if posts.count > 4 && post == posts[posts.count - (posts.count / 4)], + if posts.count > 4, post == posts[posts.count - (posts.count / 4)], !endOfData, visible { Task(priority: .utility) { await onLoadNextPage() } diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index 7cfa206..7c0a1aa 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -181,7 +181,7 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length ) #endif .searchSuggestions { - if settings.searchSuggestionsMode != .disabled && isSearchablePresented { + if settings.searchSuggestionsMode != .disabled, isSearchablePresented { SearchSuggestionsView( items: searchSuggestionsItems(), searchText: searchText, @@ -273,7 +273,7 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length } } } else { - if manager.posts.isEmpty && !manager.isNavigatingHistory && !manager.isLoading { + if manager.posts.isEmpty, !manager.isNavigatingHistory, !manager.isLoading { Task(priority: .userInitiated) { await manager.fetchPosts(page: 1, tags: manager.tags, replace: true) } @@ -445,7 +445,7 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length DragGesture() .onEnded { value in if initialTag == nil { - if value.startLocation.x < 50 && value.translation.width > 100 { + if value.startLocation.x < 50, value.translation.width > 100 { withAnimation { manager.goBackInHistory() } @@ -453,8 +453,8 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length debugPrint("ContentView: Swipe left, \(manager.searchHistory)") } - if value.startLocation.x > (UIScreen.main.bounds.width - 50) - && value.translation.width < -100 + if value.startLocation.x > (UIScreen.main.bounds.width - 50), + value.translation.width < -100 { withAnimation { manager.goForwardInHistory() |