ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Is there a clang-format file for ROS 2?

asked 2019-06-07 10:55:39 -0500

rreignier gravatar image

I could not find a clang-format file to apply the rules found in the ROS 2 Developer Guide.

Does anyone know if such a file exists somewhere?

Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2019-06-07 10:58:51 -0500

Dirk Thomas gravatar image

The file is embedded in the ament_clang_formatpackage which provides the linter API / CLI: https://github.com/ament/ament_lint/b...

edit flag offensive delete link more

Comments

I don't think it can be applied to our code base, but it is close.

William gravatar image William  ( 2019-06-07 18:03:07 -0500 )edit
2

answered 2019-06-07 18:02:24 -0500

William gravatar image

We have a tool for checking and apply style with clang format called ament_clang_format (CLI tool and cmake logic to make it an automated test). However, we do not test against this right now, and I don't think ament_clang_format can cleanly apply to our code standard, due to some limitations in clang format w.r.t. to wrapping of arguments.

@mjcarroll was looking at resolving this at some point but never finished.

As @dirk-thomas mentioned we have a style file in that package, but again, if you tried to check our code base with it there would be diff's.

The one we use right now is ament_uncrustify which uses uncrustify and a definition file there to check our style. We also use ament_cpplint which uses a patched version of Google's cpplint.py to do some additional style-like checks.

You can see the list of "default" linters here:

https://github.com/ament/ament_lint/b...

And you can see that for now clang_format is commented out.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-06-07 10:55:39 -0500

Seen: 1,993 times

Last updated: Jun 07 '19