Fix formating of files accoring to precommit setup#395
Fix formating of files accoring to precommit setup#395destogl wants to merge 8 commits intoros-controls:masterfrom
Conversation
…ng build because of recent issues.
Karsten1987
left a comment
There was a problem hiding this comment.
Sorry I don't think we can merge this PR.
First off, I'd love to see the CI changes separately from the actual code formatting. I think we should change CI and come up with code formatting in a second step.
However, looking at the diff, there's a couple of things I don't agree with.
- The clang format does not seem to comply with the rest of the ROS2 code standard.
{are on a new line only on function definition, not afterif's etc. - pep (python formatting) recommends a single stroke
'for strings. - Did you actively disable
uncrustifyhere?
|
@Karsten1987 this PR is only for visibility, what you outlined is how it was done on the demos repo 👍 Here's my take on this:
|
|
I just generally not a fan of deviating from the rest of the ROS2 style guide and check/linters. If we settle on a clang-format I'd at least use the upstream clang format and look into clang tidy respectively. The rest becomes a matter of personal taste, I for my side really appreciate not having these wrapping braces everywhere. |
Please see #394...
I actually do not agree on this. I am using many integrated linters in other projects and there is rather a tendency to go for
Yes, favoring |
|
We are using the same setup as in |
|
The real show-stopper for me here is that you removed the functionality from the |
I am not sure what you are pointing at. I only removed "linter" checks from "testing" stage. The reason for this is separation of linting and testing on the CI. If we keep this, we will have a collision between
In this case, you use a different setup. CI-setup should anyway be used per-repository because you have to at least write names of your ROS-packages. On the other hand everything is tested, but in different stages. From my experience this separation leads to clarity and focus when committing the code. |
|
|
|
@destogl I am referring to your changes in the With this change, I am unable to integrate the ros2_control packages in existing ROS2 CI infrastructure as I am okay if we want to introduce a clang-format here, all I am rooting for is that existing CI infrastructure will still co-exist and work as such (cppcheck, cpplint, pyflake, pep, etc.) |
I know that, and I tried to explain exactly that. Because I don't think that My point is that using linters in tests also breaks normal builds with industrial_ci or those ros-tooling actions and this should not be the case. Because then we always have to look into logs, scroll until the end of the world to see that some linter failed, which can also simply see in another workflow.
If it has to be OK, IMHO the code with |
That's a personal opinion, there's a complete opposite opinion in which a build should be marked as failed even when a linter failed. That's how we implicitly deal with it at ROS2 core packages, in which a build is only marked as green when there's no warning, all tests passed and no linter warnings occur.
I guess I still couldn't make my point really clear here. Let's say I have 20 packages in my CI + ros2_control or eventually want to test ros2_control on the ROS2 buildfarm. The 20 packages use
Again, personal opinion. I'd consider sticking to a standard which was chosen as a ROS2 default is reason enough to not deviate from it.
This is great, and clang-format/ament_uncrustify --reformat can do a lot of work, but that's not the real pain point here. Things like pep, cppcheck, cpplint don't only format code, they validate your code. If there're tools for it which address all these things automatically that would be great - But I am not aware of such a tool. |
I still don't get it. How can issue happen if everything in master branch is checked anyway. We don't remove any tests, but rather add additional ones here. Sorry, I cann't really see the issue here....
Black is actually addressing most of the pep issued automatically, so a reason more to keep it. P.S. This is fun, but we will not come to a consensus I believe... |
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
Here is the result of the new format. We don't have to merge this, but it makes the consequences visible.
The whole reformatting took less than 10s on the whole repository.