Skip to content

Commit

Permalink
enable swiftlint
Browse files Browse the repository at this point in the history
  • Loading branch information
StefKors committed Nov 1, 2024
1 parent 322ccc8 commit 1efee62
Show file tree
Hide file tree
Showing 75 changed files with 352 additions and 422 deletions.
14 changes: 14 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
disabled_rules:
# Rule identifiers turned on by default to exclude from running
- colon
- comma
- control_statement
# Custom rule identifiers
- line_length
- type_body_length
- todo
- for_where
- file_length
- nesting
- redundant_string_enum_value
- identifier_name
28 changes: 0 additions & 28 deletions Approval.swift

This file was deleted.

18 changes: 6 additions & 12 deletions DesktopWidgetTool/DesktopWidgetTool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ struct Provider: TimelineProvider {
)
}

init(selectedView: QueryType) {
self.selectedView = selectedView
}

// TODO: demo data? or at placeholder?
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> Void) {
Task { @MainActor in
let now = Date.now

Expand All @@ -48,7 +44,7 @@ struct Provider: TimelineProvider {

let entry = SimpleEntry(
date: now,
mergeRequests: mergeRequests, //Array(mergeRequests.prefix(5)),
mergeRequests: mergeRequests, // Array(mergeRequests.prefix(5)),
accounts: accounts,
repos: repos,
selectedView: selectedView
Expand All @@ -57,7 +53,7 @@ struct Provider: TimelineProvider {
}
}

func getTimeline(in context: Context, completion: @escaping (Timeline<SimpleEntry>) -> ()) {
func getTimeline(in context: Context, completion: @escaping (Timeline<SimpleEntry>) -> Void) {
Task { @MainActor in
var entries: [SimpleEntry] = []

Expand All @@ -83,18 +79,18 @@ struct Provider: TimelineProvider {
// moreRepos.append(contentsOf: repos)
// moreRepos.append(contentsOf: repos)

//let mergeRequests = (
// let mergeRequests = (
// try? context.fetch(
// FetchDescriptor<MergeRequest>(predicate: #Predicate {
// $0.type == type
// })
// )
//) ?? []
// ) ?? []

entries.append(
SimpleEntry(
date: now,
mergeRequests: mergeRequests, //Array(mergeRequests.prefix(5)),
mergeRequests: mergeRequests, // Array(mergeRequests.prefix(5)),
accounts: accounts,
repos: repos,
selectedView: selectedView
Expand Down Expand Up @@ -155,7 +151,6 @@ struct ReviewRequestedMergeRequestWidget: Widget {
}
}


struct LaunchPadWidget: Widget {
var body: some WidgetConfiguration {
StaticConfiguration(kind: "LaunchpadWidget", provider: Provider(selectedView: .authoredMergeRequests)) { entry in
Expand All @@ -169,4 +164,3 @@ struct LaunchPadWidget: Widget {
.supportedFamilies([.systemSmall, .systemMedium])
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI
import WidgetKit

struct LaunchPadWidgetEntryView : View {
struct LaunchPadWidgetEntryView: View {
var entry: Provider.Entry

@Environment(\.widgetFamily) var family
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ import SwiftUI

struct MediumLaunchPadWidgetView: View {
let repos: [LaunchpadRepo]

var body: some View {
ViewThatFits {
WrappingHStack {
WidgetLaunchPadRow(repos: repos, length: 10)
}

WrappingHStack {
WidgetLaunchPadRow(repos: repos, length: 9)
}

WrappingHStack {
WidgetLaunchPadRow(repos: repos, length: 8)
}

WrappingHStack {
WidgetLaunchPadRow(repos: repos, length: 7)
}

WrappingHStack {
WidgetLaunchPadRow(repos: repos, length: 6)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ struct ExtraLargeMergeRequestWidgetInterface: View {
}
}


#Preview {
ExtraLargeMergeRequestWidgetInterface(
mergeRequests: [.preview, .preview, .preview, .preview],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ struct LargeMergeRequestWidgetInterface: View {
}
}



#Preview {
LargeMergeRequestWidgetInterface(
mergeRequests: [.preview, .preview, .preview, .preview],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct MediumMergeRequestWidgetInterface: View {
Text(Image(.mergeRequest))
Text("^[\(mergeRequests.count) reviews](inflect: true) requested")
}

HStack(alignment: .center, spacing: 6) {
Text(Image(.mergeRequest))
Text(mergeRequests.count.description)
Expand All @@ -58,16 +58,15 @@ struct MediumMergeRequestWidgetInterface: View {
}

VStack(alignment: .leading, spacing: 4) {
ForEach(Array(mergeRequests.prefix(5)), id: \.id) { MR in
WidgetMRRowIcon(MR: MR, providers: providers)
ForEach(Array(mergeRequests.prefix(5)), id: \.id) { request in
WidgetMRRowIcon(request: request, providers: providers)
}
}
}
.frame(alignment: .top)
}
}


#Preview {
VStack {
GroupBox {
Expand All @@ -93,8 +92,6 @@ struct MediumMergeRequestWidgetInterface: View {
.scenePadding()
}



#Preview {
MediumMergeRequestWidgetInterface(
mergeRequests: [.preview, .preview, .preview, .preview],
Expand All @@ -103,4 +100,3 @@ struct MediumMergeRequestWidgetInterface: View {
selectedView: .authoredMergeRequests
)
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI
import WidgetKit

struct MergeRequestWidgetEntryView : View {
struct MergeRequestWidgetEntryView: View {
var entry: Provider.Entry

@Environment(\.widgetFamily) private var family
Expand Down
2 changes: 1 addition & 1 deletion DesktopWidgetTool/WidgetLaunchPadRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct WidgetLaunchPadRow: View {
let repos: [LaunchpadRepo]
let length: Int
var body: some View {
HStack() {
HStack {
ForEach(repos.prefix(length), id: \.id) { repo in
LaunchpadItem(repo: repo)
}
Expand Down
Loading

0 comments on commit 1efee62

Please sign in to comment.