Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Oct 13, 2025

Pull Request: Clarify Naming Convention Deviations in ROS 2 C++ Style Guide

What was fixed?

  • Added a clear notice in the C++ "Variable Naming" section of the documentation.
  • The notice explains that ROS 2 projects use a mix of snake_case, PascalCase, and UPPER_CASE for constants and variables, which deviates from the Google C++ Style Guide (which recommends kPascalCase for constants).
  • Rationale and guidance were provided for contributors:
    • This deviation is due to historical reasons and consistency with existing ROS codebases.
    • New projects should follow the conventions used in related ROS 2 packages.
    • When in doubt, contributors should prefer consistency with surrounding code over strict adherence to Google style.

Why was this needed?

  • There was confusion among contributors about the naming conventions, since the documentation referenced the Google C++ Style Guide but did not explain the deviations.
  • This update makes the documentation more transparent and helps maintain consistency across the codebase.

Where was it fixed?

  • The change was made in
    source/The-ROS2-Project/Contributing/Code-Style-Language-Versions.rst
    under the C++ > Variable Naming section.

Example of the new notice:

Note on naming conventions:
ROS 2 deviates from the Google C++ Style Guide in several naming areas:

  • The Google style guide recommends kPascalCase for constants (e.g., kDaysInAWeek)
  • ROS 2 projects currently use a mix of snake_case, PascalCase, and UPPER_CASE naming conventions
  • This deviation is for historical reasons and consistency with existing ROS codebases
  • For new projects, developers should follow the existing conventions in related ROS 2 packages
  • When in doubt, prefer consistency with surrounding code over strict adherence to Google style

This change improves clarity for all contributors and reviewers working on ROS 2 C++ code.


This is an automatic backport of pull request #5918 done by Mergify.

Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 8813cbc)
Copy link

HTML artifacts: https://github.com/ros2/ros2_documentation/actions/runs/18458337098/artifacts/4251975294.

To view the resulting site:

  1. Click on the above link to download the artifacts archive
  2. Extract it
  3. Open html-artifacts-5943/index.html in your favorite browser

@ahcorde ahcorde merged commit 2227681 into humble Oct 13, 2025
5 checks passed
@ahcorde ahcorde deleted the mergify/bp/humble/pr-5918 branch October 13, 2025 07:33
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