Skip to content

refactor(core): rename formatMemoryUsage to formatBytes for clarity#16713

Closed
VedantMadane wants to merge 4 commits intogoogle-gemini:mainfrom
VedantMadane:refactor/rename-formatMemoryUsage-to-formatBytes
Closed

refactor(core): rename formatMemoryUsage to formatBytes for clarity#16713
VedantMadane wants to merge 4 commits intogoogle-gemini:mainfrom
VedantMadane:refactor/rename-formatMemoryUsage-to-formatBytes

Conversation

@VedantMadane
Copy link

Summary

Renames the formatMemoryUsage function to formatBytes in the core package for improved clarity and reusability.

Changes

  • packages/core/src/utils/formatters.ts - Renamed function from formatMemoryUsage to formatBytes
  • packages/core/src/utils/formatters.test.ts - Updated test suite name and function calls
  • packages/core/src/tools/shell.ts - Updated import and usage

Rationale

  1. Clarity: formatBytes accurately describes what the function does - it formats any byte value to human-readable strings
  2. Reuse: The current name formatMemoryUsage discourages reuse because it sounds memory-specific
  3. Consistency: formatBytes aligns with common naming conventions across ecosystems

Scope

This refactor is limited to packages/core/ only. The cli/ package has its own formatMemoryUsage function which remains unchanged.

Testing

All formatter tests pass - 4 tests in formatters.test.ts

Fixes #14995

@VedantMadane VedantMadane requested review from a team as code owners January 15, 2026 04:11
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @VedantMadane, 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 focuses on enhancing code clarity and reusability within the core package by renaming a utility function. The change aims to make the function's purpose more explicit and encourage its use in various byte-formatting contexts, rather than being perceived as memory-specific. This refactor is localized to the core package, ensuring no impact on other modules like cli/ that might have their own similar functions.

Highlights

  • Function Rename: The formatMemoryUsage function in the packages/core utility module has been renamed to formatBytes to improve clarity and indicate its broader applicability beyond just memory usage.
  • Usage Updates: All internal references and usages of the formatMemoryUsage function within the packages/core module, including its test suite and the shell.ts tool, have been updated to use the new formatBytes name.
  • Dependency Updates: Several dependency entries in package-lock.json and corresponding license notices in NOTICES.txt have been updated, primarily involving the addition or removal of the 'peer: true' flag and minor version bumps for some packages.
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 refactors the formatMemoryUsage function to formatBytes for better clarity and reusability. The changes are correctly applied across the function definition, its tests, and its usage in the shell tool. The new name formatBytes more accurately reflects the function's purpose. The code changes are sound and I don't see any issues. The updates to package-lock.json and NOTICES.txt appear to be from dependency updates and are separate from the main refactoring, but they don't introduce any problems.

@NubeBuster
Copy link
Contributor

AI?
#14997

@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 19, 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
Copy link
Contributor

Adib234 commented Jan 28, 2026

Hmm this is strange, this PR was merged and does what your PR is doing #14997 closing this PR

@Adib234 Adib234 closed this Jan 28, 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

4 participants