Skip to content

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

@NubeBuster

Description

@NubeBuster

Summary

The formatMemoryUsage function in packages/core/src/utils/formatters.ts is a general-purpose byte formatting utility that converts byte values to human-readable strings (e.g., 1024"1.0 KB").

The current name formatMemoryUsage is misleading as it suggests the function is specific to memory metrics, when it actually formats any byte value.

Proposed Change

Rename formatMemoryUsageformatBytes within the core package scope only.

Files affected:

  • packages/core/src/utils/formatters.ts - rename function
  • packages/core/src/utils/formatters.test.ts - update test suite name
  • packages/core/src/tools/shell.ts - update import and usage

Why this matters:

  1. Clarity: formatBytes accurately describes what the function does
  2. Reuse: The current name discourages reuse because it sounds memory-specific, even though it's a general byte formatter
  3. Consistency: Aligns with common naming conventions (formatBytes is standard across ecosystems)

Scope

This refactor is limited to packages/core/ only. The cli/ package has its own formatMemoryUsage function which remains unchanged (intentional package independence per project conventions).

Metadata

Metadata

Assignees

Labels

area/coreIssues related to User Interface, OS Support, Core Functionalitygood first issuehelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!kind/enhancementpriority/p3Backlog - a good idea but not currently a priority.status/bot-triagedtype/task

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions