Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fixed on_set_chained_mode implementations to avoid cpplint warnings #1564

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bhagyeshagresar
Copy link

@bhagyeshagresar bhagyeshagresar commented Mar 2, 2025

Fixed warnings generated by cpplint/cpplint#131 on some of the controllers that implement the chained mode.

@@ -689,8 +689,9 @@ controller_interface::CallbackReturn DiffDriveController::configure_side(

bool DiffDriveController::on_set_chained_mode(bool chained_mode)
{
// Always accept switch to/from chained mode (without linting type-cast error)
return true || chained_mode;
// Fix to adhere to CppLint standards
Copy link
Member

@bmagyar bmagyar Mar 2, 2025

Choose a reason for hiding this comment

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

A moor reference isn't really adhering to cppkint standards ;)

Copy link
Member

Choose a reason for hiding this comment

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

You can achieve the same by commenting out the name of the argument. It tricks the parser and also the compiler. We already use that approach in the codebase, just look for "/*" in ros2_control

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I don't think so. See #1491 and the linked cpplint issue.

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! Great that you found out this. Please take a look at the solution I recommended.

@@ -689,8 +689,9 @@ controller_interface::CallbackReturn DiffDriveController::configure_side(

bool DiffDriveController::on_set_chained_mode(bool chained_mode)
{
// Always accept switch to/from chained mode (without linting type-cast error)
return true || chained_mode;
// Fix to adhere to CppLint standards
Copy link
Member

Choose a reason for hiding this comment

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

You can achieve the same by commenting out the name of the argument. It tricks the parser and also the compiler. We already use that approach in the codebase, just look for "/*" in ros2_control

@christophfroehlich christophfroehlich linked an issue Mar 2, 2025 that may be closed by this pull request
8 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix cpplint warning
3 participants