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

Format code with consistent style. #125

Closed
dbaarda opened this issue Oct 15, 2017 · 0 comments
Closed

Format code with consistent style. #125

dbaarda opened this issue Oct 15, 2017 · 0 comments
Assignees

Comments

@dbaarda
Copy link
Member

dbaarda commented Oct 15, 2017

Currently the code uses a mixture of old GNU style and some kind of Linux kernel style hybrid, and it's pretty messy. There is not even a consistent style within individual files. This complicates pull requests which often include unrelated reformatting because it makes people cringe and they can't leave it alone (in some cases peoples editors reformat stuff automatically).

The docbook comments are not too bad, but there is some degree of inconsistency, with some using auto-brief style (first para is the "brief"), and some using \brief tags.

We need to decide on a style, pick a tool to enforce it, add some kind of config or make support for it, document it, and reformat all the code. In other projects I've added a "make tidy" target to reformat the code using gnu indent with args for our recommended style. Others seem to be converging on clang-format which can use a .clang-format config file for your style settings. I've also written a wrapper for indent to address some of it's deficiencies here;

https://github.com/dbaarda/tidyc

This might be OK for a once-off reformat effort, particularly of docbook comments, but it's to esoteric to make our default reformat tool.

We also need to make sure we don't reformat code taken from upstream sources, like blake2, so that we have clean diffs against the upstream source. Fortunately this is now in it's own subdirectory so is easy to exclude.

@dbaarda dbaarda self-assigned this Oct 17, 2017
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