Skip to content

feat(dev-docs): Require the measurement unit in names if it is not in the static type.#65

Open
davidlion wants to merge 4 commits into
y-scope:mainfrom
davidlion:var_naming_units
Open

feat(dev-docs): Require the measurement unit in names if it is not in the static type.#65
davidlion wants to merge 4 commits into
y-scope:mainfrom
davidlion:var_naming_units

Conversation

@davidlion

@davidlion davidlion commented Jun 26, 2026

Copy link
Copy Markdown
Member

Description

Added a general section to explicitly name measurement units if not handled by the type.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

CI passing.

Summary by CodeRabbit

  • Documentation
    • Added a new naming guidance section.
    • Clarified how to name variables and fields that represent measurement units.
    • Recommended including units in names when not already clear from type information (e.g., suffixes like _kb or _millisecs).
    • Noted an exception when the type or API already conveys unit details (such as strongly typed time APIs).

@davidlion davidlion requested a review from a team as a code owner June 26, 2026 03:53
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The contributor guide adds a new Naming subsection that defines measurement-unit naming rules, including suffix-based unit naming when type information does not already express the unit.

Changes

Naming documentation

Layer / File(s) Summary
Measurement units guidance
docs/dev-docs/dev-guide/contrib-guides-general.md
Adds a Measurement units subsection under Naming with explicit unit naming rules, suffix guidance, C++ examples, and a std::chrono exception.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the new documentation guidance about including measurement units in names when the type does not encode them.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/dev-docs/dev-guide/contrib-guides-general.md`:
- Around line 13-15: The C++ example text has awkward wording and a missing
comma; revise the sentence in the contribution guide to read more naturally by
adding the comma after “integer type” and rephrasing the “name the variable with
a `_kb` suffix” part so it clearly describes the naming convention rather than
sounding like a command. Update the example sentence in the docs section that
mentions `_kb` and `_ms` suffixes to improve clarity and flow.
- Around line 9-11: The sentence in the contributor guide is missing the comma
in the conditional clause, so update the wording in the measurement-units
guidance to separate “If the unit is not statically available in the type
information” from “then it must be added to the name.” Make this edit in the
paragraph containing the unit naming rule so the readability is improved without
changing the meaning.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 908feeba-d00c-47d3-83e6-983e6966a2a0

📥 Commits

Reviewing files that changed from the base of the PR and between fb4670d and d9afd19.

📒 Files selected for processing (1)
  • docs/dev-docs/dev-guide/contrib-guides-general.md

Comment thread docs/dev-docs/dev-guide/contrib-guides-general.md
Comment thread docs/dev-docs/dev-guide/contrib-guides-general.md Outdated

@kirkrodrigues kirkrodrigues left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some questions before I suggest some rephrasing.

Comment on lines +13 to +14
For example, in C++ when storing a measure of kilobytes inside an integer type, name the variable
with a `_kb` suffix (e.g. `encoded_size_kb`). Similarly, when measuring milliseconds in an integer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, we should use "kibibytes" for correctness, right? In which case, should the suffix be kib? Though that might not be very recognizable, lol.


For example, in C++ when storing a measure of kilobytes inside an integer type, name the variable
with a `_kb` suffix (e.g. `encoded_size_kb`). Similarly, when measuring milliseconds in an integer
add an `_ms` suffix (e.g. `parsing_time_ms`).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

_ms is actually ambiguous as to whether it's milli or mega. We've been trying to do _millis or _millisecs in newer code.

@davidlion davidlion requested a review from kirkrodrigues July 2, 2026 13:36

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/dev-docs/dev-guide/contrib-guides-general.md`:
- Around line 16-18: The example in the contributor guide still uses a somewhat
abbreviated unit suffix, which conflicts with the new clarity guidance. Update
the sample identifier in the paragraph to use a fully spelled-out unit name so
the example itself demonstrates the rule; adjust the wording around the
milliseconds example and the identifier shown in the guidance to keep the
convention consistent and self-explanatory.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e2b22e36-05ef-4aa9-b89a-eaf421479181

📥 Commits

Reviewing files that changed from the base of the PR and between 62e3da3 and 84584eb.

📒 Files selected for processing (1)
  • docs/dev-docs/dev-guide/contrib-guides-general.md

Comment on lines +16 to +18
It is not a requirement to use abbreviations, as the goal is clarity. For example, when measuring
milliseconds adding `_ms` is actually ambiguous as to whether it's milli or mega, so we use
`_millisecs` (e.g. `parsing_time_millisecs`).

@coderabbitai coderabbitai Bot Jul 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer a clearer unit suffix in the example.

This example still relies on a fairly terse abbreviation, which weakens the “clarity” rule you just introduced. Consider spelling out the unit in the sample identifier so the guidance is self-explanatory.

Proposed wording
-For example, when measuring milliseconds adding `_ms` is actually ambiguous as to whether it's milli or mega, so we use `_millisecs` (e.g. `parsing_time_millisecs`).
+For example, when measuring milliseconds, use a `_milliseconds` suffix (e.g. `parsing_time_milliseconds`).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
It is not a requirement to use abbreviations, as the goal is clarity. For example, when measuring
milliseconds adding `_ms` is actually ambiguous as to whether it's milli or mega, so we use
`_millisecs` (e.g. `parsing_time_millisecs`).
It is not a requirement to use abbreviations, as the goal is clarity. For example, when measuring
milliseconds, use a `_milliseconds` suffix (e.g. `parsing_time_milliseconds`).
🧰 Tools
🪛 LanguageTool

[style] ~17-~17: Consider shortening this phrase to just “whether”, or rephrase the sentence to avoid “as to”.
Context: ...onds adding _ms is actually ambiguous as to whether it's milli or mega, so we use `_millise...

(WHETHER)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/dev-docs/dev-guide/contrib-guides-general.md` around lines 16 - 18, The
example in the contributor guide still uses a somewhat abbreviated unit suffix,
which conflicts with the new clarity guidance. Update the sample identifier in
the paragraph to use a fully spelled-out unit name so the example itself
demonstrates the rule; adjust the wording around the milliseconds example and
the identifier shown in the guidance to keep the convention consistent and
self-explanatory.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@kirkrodrigues I'm guessing there is a better word for "clarity" here that also address the rabbit's concern (I don't fully agree with it, but I see its point).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@davidlion, since your main concern was ambiguity between "milli" and "mega" rather than clarity in general, you could reframe the goal around unambiguity rather than (or in addition to) clarity. A few options:

  1. "It is not a requirement to use abbreviations, as the goal is to avoid ambiguity."
  2. "It is not a requirement to use abbreviations, as the goal is clarity and unambiguity."
  3. "Abbreviations are not required; prefer whichever form is unambiguous and easy to recognize."

Option 1 directly ties the rule to the actual problem being illustrated (the _ms milli/mega confusion), which should satisfy the original nit without necessarily forcing a fully spelled-out suffix like _milliseconds — you could still keep _millisecs as the example if you feel that's unambiguous enough in your codebase's context. Let me know which direction you'd like and I can help refine the wording further.

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