-
Notifications
You must be signed in to change notification settings - Fork 122
Use negative indenting for access specifiers #555
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
base: rolling
Are you sure you want to change the base?
Conversation
In order to get correct indentation of access specifiers in nested classes, the negative of the indent_columns value is used instead of the absolute leftmost column. Signed-off-by: Felix Blix Everberg <[email protected]>
|
See related issue: #554 |
|
Seems reasonable, but we cannot merge it right away if it affects uncrustify tests in the ROS 2 core, unless someone fixes them. Let me run CI with this PR to see what fails, if any. |
|
Pulls: #555 |
if you only care about using this with your own package, you can simply point
|
|
I see your point. I already fixed it for my project, but I thought I would start the discussion. I don't know how prevalent nested classes are in the rclcpp lib, but considering all other packages as well, this might be disruptive. |
|
If we do want to merge this PR to be merged, all repos listed here have to be updated: https://github.com/ros2/ros2/blob/rolling/ros2.repos. Other (non-ROS core) repos can be updated, but that's not strictly required. That being said, we indeed also have to consider that this is kind of a breaking change for downstream users. Is there a way to have uncrustify accept both ways, i.e., never indented or indented based on the indentation level of the corresponding class? |
|
I don't think you can make uncrustify have it both ways from what I read looking into the options today, but I'll try to find some time to look into it tomorrow. |
|
Would it be possible to run ros core CI with the proposed config without merging, to see which repos break? |
That's what I did in this comment above: #555 (comment) We're having issues with our CI so the test result/report page is disabled, but looking at the list of failed tests on the main job page, it looks like the following packages have uncrustify errors with this PR's uncrustify config:
If you click on "Console Output" on the left and then click "Full Log" or "View as plain text" you can find the test output to see what uncrustify is complaining about specifically. For example, here's one of the files uncrustify is complaining about for |
|
Sorry, I was on my phone yesterday, and missed the first comment. I still can't see a way to get uncrustify to accept both indentations, and I don't think there is one. |
|
From issue triage meeting, putting this on the ROS PMC meeting agenda due to it's potential for disruption to downstream users. |
|
Worth noting, while it's still fresh: @wjwwood mentioned during the triage meeting that he sees this as more of a bug fix, because we should be properly indenting access specifiers. This could be used to justify breaking users' test, although this is so minor that maybe it's not worth breaking linter tests. |
|
We discussed this in today's ROS PMC meeting. In general, we agreed to move forward with this in Rolling. However, we should announce this change with a Discourse post. Probably in the ROS General category? The post should:
@fbe555 do you want to make the post? Otherwise, no worries, I can do it! If the feedback we get is that users really don't want this disruption, then we can look into having |
|
@christophebedard I think it's best if you make the post. My response times will likely be a bit patchy for the next few weeks. |
|
Will it be possible with this PR to develop multi-distro code in a single branch? Many projects want to have only a single branch for all supported ROS2 distros. Wouldn't this change make it impossible? Or is there e.g. something like |
|
There is an enable/disable comment that could be used to fence problematic sections. I haven't tested this, but it should work for this. |
|
Yep! Great point, that use-case is important. Uncrustify ignores indentation for lines in between Or you can migrate to the new uncrustify config and use it (explicitly) with all distros. We could backport/copy this change to a new (non-default) uncrustify config file for older distros. However, it's probably simpler to use the above comments (vs explicitly setting the config file). |
This would be great for downstream developers (ideally with a short tutorial on how to enable this config :) ). The question is whether this copied file should not exist even in rolling to make this use-case as easy as possible. But in rolling it could be just a symlink. |
In order to get correct indentation of access specifiers in nested classes, the negative of the indent_columns value is used instead of the absolute leftmost column.