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 {
259259 )
260260 }
261261
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
262291 @ViewBuilder
263292 private var content: some View {
264293 if store.events.isEmpty && !store.errorMessages.isEmpty {
265294 StatusView(systemImage: "exclamationmark.triangle", tint: .orange, message: store.errorMessages.joined(separator: "\n\n"))
266295 } else if store.events.isEmpty && !store.isLoading {
267296 VStack(spacing: 8) {
268 if store.filter.isActive && store.filteredOutCount > 0 {
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 }
297 emptyStatus
291298 if !store.unavailableNotices.isEmpty {
292299 NoticeBanner(messages: store.unavailableNotices)
293300 .padding(.horizontal)
@@ -599,33 +606,38 @@ private struct ErrorBanner: View {
599606 let messages: [String]
600607
601608 var body: some View {
602 VStack(alignment: .leading, spacing: 4) {
603 ForEach(messages, id: \.self) { message in
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))
609 MessageBanner(messages: messages, systemImage: "exclamationmark.triangle", font: .caption,
610 foreground: AnyShapeStyle(.orange), background: AnyShapeStyle(.orange.opacity(0.1)))
612611 }
613612}
614613
615614private struct NoticeBanner: View {
616615 let messages: [String]
617616
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
618630 var body: some View {
619631 VStack(alignment: .leading, spacing: 4) {
620632 ForEach(messages, id: \.self) { message in
621 Label(message, systemImage: "info.circle")
622 .font(.caption2)
623 .foregroundStyle(.secondary)
633 Label(message, systemImage: systemImage)
634 .font(font)
635 .foregroundStyle(foreground)
624636 }
625637 }
626638 .frame(maxWidth: .infinity, alignment: .leading)
627639 .padding(10)
628 .background(.secondary.opacity(0.08))
640 .background(background)
629641 }
630642}
631643