refactor: rename formatMemoryUsage to formatBytes#14997
Conversation
The function is a general-purpose byte formatter, not specific to memory. Renaming improves clarity and reflects its actual usage across the codebase (shell binary output, memory display, bug reports). Fixes google-gemini#14995
Summary of ChangesHello @NubeBuster, 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 implements a refactoring change to improve the semantic clarity of a widely used utility function. The function, previously named Highlights
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 correctly renames formatMemoryUsage to formatBytes to better reflect its general-purpose nature. The changes are applied consistently across all relevant files. I've identified an opportunity to improve maintainability by removing a duplicated formatBytes function in the cli package and instead using the implementation from the core package, which I've detailed in a comment.
Co-authored-by: Adib234 <[email protected]>
Co-authored-by: Adib234 <[email protected]>
Co-authored-by: Adib234 <[email protected]>
Summary
formatMemoryUsagetoformatBytesacross bothcoreandclipackagesFiles Changed (9)
packages/core/src/utils/formatters.ts- Function definitionpackages/core/src/utils/formatters.test.ts- Test suitepackages/core/src/tools/shell.ts- Binary output displaypackages/cli/src/ui/utils/formatters.ts- CLI package copypackages/cli/src/ui/utils/formatters.test.ts- CLI testspackages/cli/src/ui/commands/bugCommand.ts- Bug report memory infopackages/cli/src/ui/commands/bugCommand.test.ts- Bug command testspackages/cli/src/ui/hooks/shellCommandProcessor.ts- Shell outputpackages/cli/src/ui/components/MemoryUsageDisplay.tsx- Memory displayTest plan
formatBytestests passFixes #14995