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

clang format #423

Closed
wants to merge 3 commits into from
Closed

clang format #423

wants to merge 3 commits into from

Conversation

christian-rauch
Copy link
Member

@christian-rauch christian-rauch commented Jan 25, 2021

This adapts the code style to the one used by Qt Creator using clang-format with the style file from the upstream project: https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/.clang-format.

Since this PR touches every file, I would hold off the merge until we know that this style file is the correct one that we need to get the plugin merged upstream.

Edit: I added a script that applies the style to all source and header files. It has to be called from the source root. Note that different clang-format versions can result in different results. This is with clang-format 10.

@Levi-Armstrong
Copy link
Member

The other piece is the variable/parameter naming. Half way through writing this plugin I was using the ROS naming convention and then thought about the possible of contributing back. Is there a way to easily go through and change variable and parameter names?

@christian-rauch
Copy link
Member Author

The other piece is the variable/parameter naming.

Is this the m_ convention for member variables? This can be done with the refactoring function in Qt Creator.

@Levi-Armstrong
Copy link
Member

The other piece is the variable/parameter naming.

Is this the m_ convention for member variables? This can be done with the refactoring function in Qt Creator.

Yea, I also did not know if clang-tidy would do some of this instead of manually having to go through.

@christian-rauch
Copy link
Member Author

The other piece is the variable/parameter naming.

Is this the m_ convention for member variables? This can be done with the refactoring function in Qt Creator.

Yea, I also did not know if clang-tidy would do some of this instead of manually having to go through.

clang-tidy can check and change variable name conventions: https://clang.llvm.org/extra/clang-tidy/checks/readability-identifier-naming.html#cmdoption-arg-memberprefix but I haven't found a .clang-tidy in the upstream project. I will look into this.

@vincent-hui
Copy link

If ros_qtc_plugin is added to the super-repo of Qt Creator as submodule, there would be no hard requirement to stick to Qt Creator coding style rules.

@christian-rauch
Copy link
Member Author

Since integrating this into the Qt Creator upstream repo is not on the horizon, there is no real need to apply their code style. I am going to close this as the applied code style will clash anyway with the current state. The .clang-format file from this PR can still be reused later.

@christian-rauch christian-rauch deleted the clang-format branch September 3, 2021 11:31
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