Skip to content

Commit

Permalink
Fix codefactor warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodmoldrich committed Jan 17, 2025
1 parent d2dc9e9 commit f9e46f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions App/App_macOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ struct Kiwix: App {
CommandGroup(after: .textEditing) {
Button("Search") {
if let toolbar = NSApp.keyWindow?.toolbar,
let search = toolbar.items.first(where: { $0.itemIdentifier.rawValue == "com.apple.SwiftUI.search" }) as? NSSearchToolbarItem {
search.beginSearchInteraction()
}
let item = toolbar.items.first( where: { $0.itemIdentifier.rawValue == "com.apple.SwiftUI.search" } ),

Check notice on line 78 in App/App_macOS.swift

View check run for this annotation

codefactor.io / CodeFactor

App/App_macOS.swift#L78

Line should be 120 characters or less; currently it has 125 characters (line_length)

Check notice on line 78 in App/App_macOS.swift

View check run for this annotation

codefactor.io / CodeFactor

App/App_macOS.swift#L78

Closing brace with closing parenthesis should not have any whitespaces in the middle (closing_brace)
let search = item as? NSSearchToolbarItem { search.beginSearchInteraction() }
}.keyboardShortcut("f", modifiers: [.command, .shift])
}
}
Expand Down
4 changes: 1 addition & 3 deletions Views/BrowserTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ struct BrowserTab: View {
ArticleShortcutButtons(displayMode: .mainAndRandomArticle)

#if os(macOS)
Button(action: {
searchFocus = searchFocus ?? search.results.first?.id
}) {}
Button(action: { searchFocus = searchFocus ?? search.results.first?.id }, label: {})
.opacity(0)
.keyboardShortcut(.return, modifiers: [])
#endif
Expand Down
6 changes: 3 additions & 3 deletions Views/SearchResults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct SearchResults: View {
.onMoveCommand { direction in
let results = viewModel.results
if let searchFocus = self.searchFocus,
let index = results.firstIndex(where: {searchFocus == $0.id}){
let index = results.firstIndex(where: {searchFocus == $0.id}) {
if direction == .up,
index > results.startIndex {
let prev = results.index(before: index)
Expand Down Expand Up @@ -116,7 +116,7 @@ struct SearchResults: View {
NotificationCenter.openURL(result.url)
}

private struct SearchResultButton : View {
private struct SearchResultButton: View {
@FocusState.Binding var searchFocus: Int?
var searchText: String
var result: SearchResult
Expand All @@ -139,7 +139,7 @@ struct SearchResults: View {
}
}

private struct SearchResultButtonBase : View {
private struct SearchResultButtonBase: View {
var searchText: String
var result: SearchResult
var zimFile: ZimFile?
Expand Down

0 comments on commit f9e46f4

Please sign in to comment.