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

Code style refinements #11

Open
romangg opened this issue Mar 22, 2020 · 3 comments
Open

Code style refinements #11

romangg opened this issue Mar 22, 2020 · 3 comments

Comments

@romangg
Copy link
Member

romangg commented Mar 22, 2020

The project currently follows the KDE Frameworks Coding style as the CONTRIBUTING.md document prescribes. The style is not perfect and does not seem to be actively maintained. We might want to deviate from it, in particular because there is the opportunity to enforce a style with CI. Following a list of possible changes:

change reason
left reference/pointer alignment: int* x C++ Core Guidelines does it this way. Also see p. xxxii [1].
const qualifier always to the right: int const x See p. xxxi [1].
comment unnamed parameters or use [[maybe_unused]] both have advantages in certain situations
use lowercase snake-case style of STL
... ...

[1] Vandevoorde: C++ Templates: The Complete Guide

@romangg
Copy link
Member Author

romangg commented Apr 15, 2020

This is being executed on the server-objects branch as part of the server objects remodel prototype work #15.

The included clang-format check was adjusted to enforce the ref/pointer alignment. For the const position there is currently no clang-format check possible.

@romangg
Copy link
Member Author

romangg commented May 22, 2020

Server objects rework has been landed. We enforce the left reference/pointer alignment in there now with clang-format.

clang-format doesn't enforce const qualifier positioning though. Maybe something to look into in the future.

Let's leave this issue open for now to maybe define more refinements in the future.

@romangg
Copy link
Member Author

romangg commented Aug 30, 2021

Not all of the style can be enforced through clang-format. At some point we should formulate a style guide so it's clearly documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant