Conversation
…s struct formatStatuslineOutput had 12 positional parameters making call sites hard to read and error-prone. Introduce a statuslineParams struct with named fields for clarity and easier future extension. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary of ChangesHello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a great refactoring that significantly improves the readability and maintainability of the formatStatuslineOutput function by replacing a long list of positional parameters with a statuslineParams struct. The changes are well-executed and the updated test files clearly demonstrate the benefits of this new approach.
I have one suggestion to make the URL construction more robust, which is a minor improvement on the existing logic.
| url := fmt.Sprintf("%s/users/%s/coding-agent/session/%s", webEndpoint, userLogin, sessionID) | ||
| sessionStr := color.Cyan.Sprintf("💰 $%.2f", p.SessionCost) | ||
| if p.UserLogin != "" && p.WebEndpoint != "" && p.SessionID != "" { | ||
| url := fmt.Sprintf("%s/users/%s/coding-agent/session/%s", p.WebEndpoint, p.UserLogin, p.SessionID) |
There was a problem hiding this comment.
Using fmt.Sprintf for URL concatenation can be brittle. If p.WebEndpoint has a trailing slash, this will result in a double slash in the URL (e.g., https://example.com//users/...). For more robust URL construction, it's better to handle this case.
A simple way to fix this is to use strings.TrimRight to remove any trailing slash from the base URL.
This same issue exists on lines 206 and 223.
| url := fmt.Sprintf("%s/users/%s/coding-agent/session/%s", p.WebEndpoint, p.UserLogin, p.SessionID) | |
| url := fmt.Sprintf("%s/users/%s/coding-agent/session/%s", strings.TrimRight(p.WebEndpoint, "/"), p.UserLogin, p.SessionID) |
Summary
statuslineParamsstruct to replace 12 positional parameters informatStatuslineOutputcommandCCStatuslineand all ~13 test call sites to use named struct fieldsfalse,nil,0) can now be omitted at call sites, improving readabilityTest plan
go test ./commands/ -run TestCCStatuslineTestSuite -count=1passesgo vet ./commands/clean🤖 Generated with Claude Code