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

Use clang-format in CI to ensure consistent formatting across developer submissions. #44

Open
billhollings opened this issue Feb 12, 2018 · 3 comments
Assignees

Comments

@billhollings
Copy link
Contributor

No description provided.

@karl-lunarg
Copy link
Contributor

Just a note: This is best left until after this repo is made public because Travis-CI only works with public repos.

(Building the repo in CI would be a nice thing to have, too)

@karl-lunarg
Copy link
Contributor

karl-lunarg commented Mar 2, 2018

To proceed on this:

  • Need to decide on what version of clang-format to use. Yes, this matters (slightly) because different major versions of clang-format format differently. macOS 10.12 seems to have version 6.0.0. You would want to document this in a CONTRIBUTING.md. We also would want to match the version running on the CI machine. While it may be possible to install a specific version on the CI machine, it may be good to know what version is already there. (I tried to submit a Travis job from my fork to query this, but Travis seems to be having trouble displaying logs at the moment.)

  • Need to decide on clang-format parameters and put them in a .clang-format file at the top of the repo. This is where you get to pick a basic style (e.g., LLVM or Google) and make tweaks such as line length and tab size. You can look at other repos for ideas and/or try to match any existing style in the code base. Check this file into the repo.

  • Get the current repo formatted. You would do this by running clang-format (using -style=file) on all the sources in the repo and commit. It probably would have been better to do this and the preceding steps before going public, but there's little that can be done about that. This does introduce a "format only" commit that will show up often in "git blame" type searches in the code base, but that would have to be tolerated.

  • Add the CI plumbing to check that incoming PRs are formatted. (The point of this issue). As an example, this was added with KhronosGroup/Vulkan-LoaderAndValidationLayers@b11b529. I'd be happy to do this part of it once the able above steps are done.

@karl-lunarg
Copy link
Contributor

Travis got healthy again. clang-format is not installed by default, but is easily installed with brew, and it is version 6.0.0.

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

2 participants