Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add custom clang-format, re-format all code #2

Open
wants to merge 7 commits into
base: jazzy-2.0RC
Choose a base branch
from

Conversation

civerachb-cpr
Copy link

Nobody liked the default code formatting, so use PickNik's formatting instead.

@ghost
Copy link

ghost commented Nov 8, 2024

I still prefer Aligning assignment and declarations. We could set them to Consecutive so it isn't aligned across empty lines. Ideally we would have a comment for each distinct block of assignments/declarations which would also start a new alignment block.

We could see what the rest of the team thinks

@ghost
Copy link

ghost commented Nov 8, 2024

Also rather than setting BinPackParameters to false setting BinPackParameters to OnePerLine will allow multiple params to be on one line if they fit but do one per line if they don't. disabling it all together will have them always on different lines.

Correction: I thought you were setting BinPackArguments to false. It seems setting BinPackParameters to false is having a similar effect. But I still think its better to set it to OnePerLine

@civerachb-cpr
Copy link
Author

I tried setting these, but they didn't actually make any difference:

AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: Consecutive
...
BinPackParameters: OnePerLine

I'm ambivalent about aligning declarations & assignments. Frequently they're different types anyway, so it doesn't bother me too much if they're not aligned.

# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
list(APPEND AMENT_LINT_AUTO_EXCLUDE
ament_cmake_copyright
Copy link
Member

Choose a reason for hiding this comment

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

Does this pass if enabled?

Copy link
Author

Choose a reason for hiding this comment

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

No:

test 1
    Start 1: copyright

1: Test command: /usr/bin/python3 "-u" "/opt/ros/jazzy/share/ament_cmake_test/cmake/run_test.py" "/home/civerachb/Code/clearpath_common_ws/build/puma_motor_driver/test_results/puma_motor_driver/copyright.xunit.xml" "--package-name" "puma_motor_driver" "--output-file" "/home/civerachb/Code/clearpath_common_ws/build/puma_motor_driver/ament_copyright/copyright.txt" "--command" "/opt/ros/jazzy/bin/ament_copyright" "--xunit-file" "/home/civerachb/Code/clearpath_common_ws/build/puma_motor_driver/test_results/puma_motor_driver/copyright.xunit.xml"
1: Working Directory: /home/civerachb/Code/clearpath_common_ws/src/clearpath_motor_drivers/puma_motor_driver
1: Test timeout computed to be: 200
1: -- run_test.py: invoking following command in '/home/civerachb/Code/clearpath_common_ws/src/clearpath_motor_drivers/puma_motor_driver':
1:  - /opt/ros/jazzy/bin/ament_copyright --xunit-file /home/civerachb/Code/clearpath_common_ws/build/puma_motor_driver/test_results/puma_motor_driver/copyright.xunit.xml
1: include/puma_motor_driver/can_proto.hpp: copyright=Texas Instruments Incorporated.  All rights reserved. (2008-2013), license=<unknown>
1: include/puma_motor_driver/driver.hpp: copyright=Clearpath Robotics, Inc., All rights reserved. (2015), license=<unknown>
1: include/puma_motor_driver/multi_puma_node.hpp: copyright=Clearpath Robotics, Inc., All rights reserved. (2024), license=<unknown>
1: src/driver.cpp: copyright=Clearpath Robotics, Inc., All rights reserved. (2015), license=<unknown>
1: src/multi_puma_node.cpp: copyright=Clearpath Robotics, Inc., All rights reserved. (2024), license=<unknown>
1: 5 errors, checked 5 files
1: -- run_test.py: return code 1
1: -- run_test.py: verify result file '/home/civerachb/Code/clearpath_common_ws/build/puma_motor_driver/test_results/puma_motor_driver/copyright.xunit.xml'
1/4 Test #1: copyright ........................***Failed    0.59 sec

Copy link

Choose a reason for hiding this comment

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

Even if we added a "clearpath" copyright type the can_proto file would fail. There might be a way to set the test to pass if any copyright is found.

Copy link

Choose a reason for hiding this comment

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

It doesn't look like you can... So the best option would be to copy what otto did and also exclude the TI file.

mikehosmar and others added 3 commits November 8, 2024 20:45
Turns out the clang-format version bundled with vscode is 19.  I was using an extension which needs it to be installed separately.
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.

3 participants