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

Define a quda code style (code formatting only) #254

Closed
mathiaswagner opened this issue May 22, 2015 · 3 comments
Closed

Define a quda code style (code formatting only) #254

mathiaswagner opened this issue May 22, 2015 · 3 comments
Labels

Comments

@mathiaswagner
Copy link
Member

I know there are some conventions but we lack documentation for them and profiles for code formatters.

It looks like we are pretty close to Google's C++ style (in terms of formatting), see:
http://google.github.io/styleguide/cppguide.html#Formatting

There is a profile for the formatter in eclipse (i.e. Nsight) and also artistic style has one (http://astyle.sourceforge.net/astyle.html#_style=google).
Nuno has put together a list of tools to be discussed in our calls, see:
https://github.com/lattice/quda/wiki/agenda-call-2015-05-07

So, my suggestion is we start with the Google C++ style for Eclipse (you can get it here: https://github.com/google/styleguide ) check in Eclipse/Nsight what modifications are necessary to reflect the current code (we might want to avoid automatically formatting existing code with the exception of white space changes to reduce merge conflicts). I have added an example screen shot.
screen shot 2015-05-22 at 10 00 04

Once we decided on that we can set up a wiki page with our conventions and configuration files for the formatting tools (say Eclipse, astyle, uncristify) ?

Any comments on this?

@maddyscientist
Copy link
Member

I'm actually in favour of using a project-wide formatting solution rather than rely on developers to maintain this. Despite the fact that this will cause a global edit, I think the advantage of never having to worry about formatting again outweighs this disadvantage. Moreover, using a project-wide format solution will remove any accidental tab / space formatting differences for ever more. If we picked an appropriate moment to make this change, e.g., after most development branches are merged into develop, then this shouldn't be too disruptive.

If we did go with such a solution we'd need to be careful that the Python generated dslash core files correspond to this standard and/or we remove the generated core files form the repository and simply generate them as part of the configure/make process.

@j-stephan
Copy link

j-stephan commented Nov 20, 2017

Note that there are style guidelines from the ISO C++ committee:

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#S-naming

However, they recommend snake_case everywhere, similar to the STL. As far as I can see this would require extensive renaming in QUDA.

This also looks like a duplicate of #83.

@mathiaswagner
Copy link
Member Author

closing this as we have a .clang-format file now.

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

No branches or pull requests

3 participants