Skip to content

refactor: rename formatMemoryUsage to formatBytes#14997

Merged
Adib234 merged 6 commits intogoogle-gemini:mainfrom
NubeBuster:nubebuster/refactor/formatMemoryUsage-to-formatBytes
Jan 27, 2026
Merged

refactor: rename formatMemoryUsage to formatBytes#14997
Adib234 merged 6 commits intogoogle-gemini:mainfrom
NubeBuster:nubebuster/refactor/formatMemoryUsage-to-formatBytes

Conversation

@NubeBuster
Copy link
Contributor

Summary

  • Renames formatMemoryUsage to formatBytes across both core and cli packages
  • The function is a general-purpose byte formatter, not specific to memory
  • Renaming improves clarity and reflects its actual usage (shell binary output, memory display, bug reports)

Files Changed (9)

  • packages/core/src/utils/formatters.ts - Function definition
  • packages/core/src/utils/formatters.test.ts - Test suite
  • packages/core/src/tools/shell.ts - Binary output display
  • packages/cli/src/ui/utils/formatters.ts - CLI package copy
  • packages/cli/src/ui/utils/formatters.test.ts - CLI tests
  • packages/cli/src/ui/commands/bugCommand.ts - Bug report memory info
  • packages/cli/src/ui/commands/bugCommand.test.ts - Bug command tests
  • packages/cli/src/ui/hooks/shellCommandProcessor.ts - Shell output
  • packages/cli/src/ui/components/MemoryUsageDisplay.tsx - Memory display

Test plan

  • All formatBytes tests pass
  • Preflight linting passes
  • No breaking changes (internal function rename only)

Fixes #14995

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
@NubeBuster NubeBuster requested a review from a team as a code owner December 12, 2025 15:53
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 formatMemoryUsage, has been renamed to formatBytes. This change was made because the function is a general-purpose byte formatter used in various contexts beyond just memory display, such as shell binary output and bug reports. The new name more accurately describes its functionality and enhances code readability and maintainability across the core and cli packages.

Highlights

  • Function Renaming: The utility function formatMemoryUsage has been renamed to formatBytes across both the core and cli packages to better reflect its general-purpose nature.
  • Improved Clarity: The original name was misleading as the function formats byte values in various contexts, not just memory usage. The new name enhances clarity and accurately describes its functionality.
  • Consistent Usage: This renaming ensures consistency with the function's actual applications, which include formatting shell binary output, displaying memory information, and generating bug reports.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gemini-cli gemini-cli bot added priority/p3 Backlog - a good idea but not currently a priority. area/core Issues related to User Interface, OS Support, Core Functionality labels Jan 7, 2026
@jacob314 jacob314 added the help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! label Jan 22, 2026
@Adib234 Adib234 added this pull request to the merge queue Jan 27, 2026
Merged via the queue into google-gemini:main with commit db028bc Jan 27, 2026
25 checks passed
yunaseoul pushed a commit that referenced this pull request Jan 27, 2026
sidwan02 pushed a commit to sidwan02/gemini-cli-gemma that referenced this pull request Feb 6, 2026
kuishou68 pushed a commit to iOfficeAI/aioncli that referenced this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p3 Backlog - a good idea but not currently a priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(core): rename formatMemoryUsage to formatBytes for clarity and reuse

3 participants