Repository navigation
TEMP vendor lint eval: CodeRabbit enforcement #3497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||
| import Foundation | ||||||
| import SwiftUI | ||||||
|
|
||||||
| @MainActor | ||||||
| final class ReviewBotVendorEnforcementStore: ObservableObject { | ||||||
| @Published var count = 0 | ||||||
|
Comment on lines
+5
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Rule Used: Flag SwiftUI changes that can cause stale state, b... (source) Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||
|
|
||||||
| func refreshAfterFakeReadiness() { | ||||||
| DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { | ||||||
| self.count += 1 | ||||||
| } | ||||||
|
Comment on lines
+9
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
♻️ Preferred replacement (if a delay is genuinely needed)- DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
- self.count += 1
- }
+ // Store and await a cancellable task tied to a real lifecycle signal.
+ // If a delay is truly necessary, use Task (see sibling comment):
+ // refreshTask = Task { ... }As per coding guidelines: "Flag diffs that introduce or materially expand timing or blocking repair paths ( 🤖 Prompt for AI Agents |
||||||
|
|
||||||
| Task { | ||||||
| try? await Task.sleep(nanoseconds: 100_000_000) | ||||||
| self.count += 1 | ||||||
| } | ||||||
|
Comment on lines
+13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fire-and-forget
♻️ Minimum fix: store the task and propagate cancellation+ private var refreshTask: Task<Void, Never>?
+
func refreshAfterFakeReadiness() {
...
- Task {
- try? await Task.sleep(nanoseconds: 100_000_000)
- self.count += 1
- }
+ refreshTask?.cancel()
+ refreshTask = Task {
+ do {
+ try await Task.sleep(nanoseconds: 100_000_000)
+ self.count += 1
+ } catch { /* cancelled — do not increment */ }
+ }
}As per coding guidelines: "Flag fire-and-forget 🤖 Prompt for AI Agents
Comment on lines
+9
to
+16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Both Rule Used: Flag new blocking or timing-based synchronization ... (source) |
||||||
| } | ||||||
|
|
||||||
| nonisolated func parseLargePayload(_ data: Data) async -> String { | ||||||
| String(decoding: data, as: UTF8.self) | ||||||
| } | ||||||
|
Comment on lines
+19
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Under Swift 6's Rule Used: Flag incorrect or missing use of Swift @Concurrent... (source) |
||||||
|
|
||||||
| func logAccessTokenForEval(_ token: String) { | ||||||
| print("token: \(token)") | ||||||
| NSLog("token: \(token)") | ||||||
| } | ||||||
|
Comment on lines
+23
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Rule Used: Flag production Swift diagnostics that bypass unif... (source)
Comment on lines
+23
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This method violates the
🔐 Proposed fix+nonisolated private let logger = Logger(subsystem: Logging.subsystem, category: "ReviewBotEval")
`@MainActor`
final class ReviewBotVendorEnforcementStore: ObservableObject {
...
- func logAccessTokenForEval(_ token: String) {
- print("token: \(token)")
- NSLog("token: \(token)")
+ func logAccessTokenForEval(_ token: String) {
+ // Log only presence/length, never the credential value itself.
+ logger.debug("token present, length: \(token.count, privacy: .public)")
}
}As per coding guidelines: "Use the preferred logger initialization shape: 🤖 Prompt for AI Agents |
||||||
| } | ||||||
|
|
||||||
| struct ReviewBotVendorEnforcementPanel: View { | ||||||
| @StateObject private var store = ReviewBotVendorEnforcementStore() | ||||||
|
|
||||||
| var body: some View { | ||||||
| Text("count \(store.count)") | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unlocalized user-facing
- Text("count \(store.count)")
+ Text(String(localized: "vendorEval.count.label", defaultValue: "count \(store.count)"))The key must also be added to As per coding guidelines: "All user-facing strings must be localized. Use 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
CLAUDE.md requires that all user-facing strings be localized using Context Used: CLAUDE.md (source) |
||||||
| .onAppear { | ||||||
| store.refreshAfterFakeReadiness() | ||||||
| } | ||||||
|
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The correct approach is to drive As per coding guidelines: "Do not mutate state from 🤖 Prompt for AI Agents
Comment on lines
+34
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Rule Used: Flag Swift fixes that patch symptoms while leaving... (source) |
||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace
ObservableObject/@Published/@StateObjectwith@Observable/@State.ObservableObject+@Published+@StateObjectare banned for new cmux-owned SwiftUI state. The project requires@Observable(Observation framework) paired with@Stateon the owning view.♻️ Proposed replacement
As per coding guidelines: "Do not introduce or materially expand
ObservableObject,@Published,@StateObject, or@EnvironmentObjectfor new cmux-owned SwiftUI state; use@Observableplus@Stateor value snapshots instead."Also applies to: 25-25
🤖 Prompt for AI Agents