krz/octosentry

macOS menu bar app to monitor GitHub security alerts github macos menubar security

Commit 32b53aa912

32b53aa912d2aa1c11a02060b43a70ebb0c24fb9

parent: 11a074c894

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-22 20:18 UTC

Add Qlty config; share banner layout, extract emptyStatus

Layout: unified · split

.qlty/.gitignore added +7
@@ -0,0 +1,7 @@
1*
2!configs
3!configs/**
4!hooks
5!hooks/**
6!qlty.toml
7!.gitignore
.qlty/qlty.toml added +44
@@ -0,0 +1,44 @@
1config_version = "0"
2
3exclude_patterns = [
4 "**/vendor/**",
5 "**/node_modules/**",
6 "**/testdata/**",
7 "**/dist/**",
8 "**/.build/**",
9 "**/build/**",
10 "**/*.min.*",
11 "**/generated/**",
12 ".claude/**",
13 "**/Pods/**",
14]
15
16test_patterns = [
17 "**/test/**",
18 "**/tests/**",
19 "**/Tests/**",
20 "**/*_test.*",
21 "**/test_*.*",
22 "**/*.test.*",
23 "**/*Tests.swift",
24 "e2e/**",
25]
26
27[[source]]
28name = "default"
29default = true
30
31[[plugin]]
32name = "osv-scanner"
33
34[[plugin]]
35name = "trufflehog"
36
37# Early returns are guard clauses, which keep the happy path unindented.
38[smells.return_statements]
39enabled = false
40
41# Total file complexity is the sum of its functions, which function_complexity
42# already checks.
43[smells.file_complexity]
44enabled = false
octosentry/SecurityEventListView.swift +49 −37
@@ -259,35 +259,42 @@ struct SecurityEventListView: View {
259 ) 259 )
260 } 260 }
261 261
262 /// Why the list is empty: filtered out, below the severity floor, nothing
263 /// watched, or genuinely no alerts.
264 @ViewBuilder
265 private var emptyStatus: some View {
266 if store.filter.isActive && store.filteredOutCount > 0 {
267 StatusView(
268 systemImage: "line.3.horizontal.decrease.circle",
269 tint: .secondary,
270 message: "\(store.filteredOutCount) alert(s) hidden by the current filter"
271 )
272 } else if store.totalFetchedCount > 0 {
273 StatusView(
274 systemImage: "line.3.horizontal.decrease.circle",
275 tint: .secondary,
276 message: "\(store.totalFetchedCount) alert(s) are below your minimum severity filter"
277 )
278 } else if store.watchedRepos.isEmpty {
279 // "No open alerts" would be misleading when nothing is
280 // being watched in the first place.
281 StatusView(
282 systemImage: "plus.circle",
283 tint: .secondary,
284 message: "No repositories watched yet — add one from the gear menu"
285 )
286 } else {
287 StatusView(systemImage: "checkmark.shield", tint: .green, message: "No open security alerts")
288 }
289 }
290
262 @ViewBuilder 291 @ViewBuilder
263 private var content: some View { 292 private var content: some View {
264 if store.events.isEmpty && !store.errorMessages.isEmpty { 293 if store.events.isEmpty && !store.errorMessages.isEmpty {
265 StatusView(systemImage: "exclamationmark.triangle", tint: .orange, message: store.errorMessages.joined(separator: "\n\n")) 294 StatusView(systemImage: "exclamationmark.triangle", tint: .orange, message: store.errorMessages.joined(separator: "\n\n"))
266 } else if store.events.isEmpty && !store.isLoading { 295 } else if store.events.isEmpty && !store.isLoading {
267 VStack(spacing: 8) { 296 VStack(spacing: 8) {
268 if store.filter.isActive && store.filteredOutCount > 0 { 297 emptyStatus
269 StatusView(
270 systemImage: "line.3.horizontal.decrease.circle",
271 tint: .secondary,
272 message: "\(store.filteredOutCount) alert(s) hidden by the current filter"
273 )
274 } else if store.totalFetchedCount > 0 {
275 StatusView(
276 systemImage: "line.3.horizontal.decrease.circle",
277 tint: .secondary,
278 message: "\(store.totalFetchedCount) alert(s) are below your minimum severity filter"
279 )
280 } else if store.watchedRepos.isEmpty {
281 // "No open alerts" would be misleading when nothing is
282 // being watched in the first place.
283 StatusView(
284 systemImage: "plus.circle",
285 tint: .secondary,
286 message: "No repositories watched yet — add one from the gear menu"
287 )
288 } else {
289 StatusView(systemImage: "checkmark.shield", tint: .green, message: "No open security alerts")
290 }
291 if !store.unavailableNotices.isEmpty { 298 if !store.unavailableNotices.isEmpty {
292 NoticeBanner(messages: store.unavailableNotices) 299 NoticeBanner(messages: store.unavailableNotices)
293 .padding(.horizontal) 300 .padding(.horizontal)
@@ -599,33 +606,38 @@ private struct ErrorBanner: View {
599 let messages: [String] 606 let messages: [String]
600 607
601 var body: some View { 608 var body: some View {
602 VStack(alignment: .leading, spacing: 4) { 609 MessageBanner(messages: messages, systemImage: "exclamationmark.triangle", font: .caption,
603 ForEach(messages, id: \.self) { message in 610 foreground: AnyShapeStyle(.orange), background: AnyShapeStyle(.orange.opacity(0.1)))
604 Label(message, systemImage: "exclamationmark.triangle")
605 .font(.caption)
606 .foregroundStyle(.orange)
607 }
608 }
609 .frame(maxWidth: .infinity, alignment: .leading)
610 .padding(10)
611 .background(.orange.opacity(0.1))
612 } 611 }
613} 612}
614 613
615private struct NoticeBanner: View { 614private struct NoticeBanner: View {
616 let messages: [String] 615 let messages: [String]
617 616
617 var body: some View {
618 MessageBanner(messages: messages, systemImage: "info.circle", font: .caption2,
619 foreground: AnyShapeStyle(.secondary), background: AnyShapeStyle(.secondary.opacity(0.08)))
620 }
621}
622
623private struct MessageBanner: View {
624 let messages: [String]
625 let systemImage: String
626 let font: Font
627 let foreground: AnyShapeStyle
628 let background: AnyShapeStyle
629
618 var body: some View { 630 var body: some View {
619 VStack(alignment: .leading, spacing: 4) { 631 VStack(alignment: .leading, spacing: 4) {
620 ForEach(messages, id: \.self) { message in 632 ForEach(messages, id: \.self) { message in
621 Label(message, systemImage: "info.circle") 633 Label(message, systemImage: systemImage)
622 .font(.caption2) 634 .font(font)
623 .foregroundStyle(.secondary) 635 .foregroundStyle(foreground)
624 } 636 }
625 } 637 }
626 .frame(maxWidth: .infinity, alignment: .leading) 638 .frame(maxWidth: .infinity, alignment: .leading)
627 .padding(10) 639 .padding(10)
628 .background(.secondary.opacity(0.08)) 640 .background(background)
629 } 641 }
630} 642}
631 643