Skip to content

refactor: replace magic numbers with named constants in format_relative_time#86

Merged
redpanda-f merged 2 commits intofeat/redpanda/noterminal-version-flagfrom
copilot/sub-pr-82
Mar 9, 2026
Merged

refactor: replace magic numbers with named constants in format_relative_time#86
redpanda-f merged 2 commits intofeat/redpanda/noterminal-version-flagfrom
copilot/sub-pr-82

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

format_relative_time used bare literals 60, 3600, and 86400 for time thresholds and divisors, making the logic harder to read and error-prone to modify.

Changes

  • src/main_app/version.rs: Introduced three module-level constants to replace all magic number occurrences:
const SECS_PER_MIN: i64  =     60;
const SECS_PER_HOUR: i64 =  3_600;
const SECS_PER_DAY: i64  = 86_400;

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ve_time

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor apply feedback on --noterminal flag for version command refactor: replace magic numbers with named constants in format_relative_time Mar 9, 2026
@redpanda-f redpanda-f marked this pull request as ready for review March 9, 2026 12:18
@redpanda-f redpanda-f merged commit 926568c into feat/redpanda/noterminal-version-flag Mar 9, 2026
@redpanda-f redpanda-f deleted the copilot/sub-pr-82 branch March 9, 2026 12:18
redpanda-f added a commit that referenced this pull request Mar 11, 2026
* feat: introduce --noterminal flag for version command

* refactor: replace magic numbers with named constants in `format_relative_time` (#86)

* Initial plan

* refactor: replace magic numbers with named constants in format_relative_time

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

* add: notty

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants