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

Sort includes by category using clang-format #2023

merged 1 commit into from May 24, 2019


Copy link

commented May 23, 2019

Header file includes should be placed from most dependent at the top to least dependent. This ensures that the header files themselves are including the correct dependent header files needed to compile correctly without relying on fluky source file include order including dependents for them. We do not generally use "" for files in the same project, so this does not fully adhere as all nano headers are grouped together in this PR but it is an improvement at least, the includes are now sorted as follows:

  1. "" - Not currently used in our source code
  2. <nano/*>
  3. <crypto|gtest/*>
  4. <boost/*>
  5. <system>

There were some header files which needed to included to fix some build failures as a result of moving them around.

@wezrule wezrule requested a review from cryptocode May 23, 2019

@wezrule wezrule self-assigned this May 23, 2019

@wezrule wezrule requested a review from argakiig May 23, 2019

Copy link

left a comment

Compiles on macos and clang-format 8.0.0 agrees with the output.

I would personally prefer stripping whitespaces between header groups, but not a big deal.

Copy link

left a comment

windows and clang-format version 6.0.1 (tags/RELEASE_601/final) agree 👍

@wezrule wezrule added this to the V19.0 milestone May 24, 2019

@wezrule wezrule merged commit 6c8420b into nanocurrency:master May 24, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

@wezrule wezrule deleted the wezrule:clang_format_sort_includes branch May 24, 2019

@wezrule wezrule added this to RC 4 (TBD) in V19 May 25, 2019

argakiig added a commit that referenced this pull request Jun 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.