FR: enforce clang-format on all source files in CI #18651

issue Warchant openend this issue on April 15, 2020
  1. Warchant commented at 11:27 am on April 15, 2020: none

    Bitcoin uses clang-format but it is not enforced by automatic tools, so we can see that some files are not formatted according to current .clang-format standard.

    This FR is also a request to format all source files according to .clang-format.

  2. Warchant added the label Feature on Apr 15, 2020
  3. MarcoFalke commented at 11:39 am on April 15, 2020: member

    Thank you for the suggestion. However, Bitcoin Core does not force developers to use a specific set of tools or a specific toolchain. Every developer can use the editor or IDE of their choice and can format code freely, as long as it is valid python or C++. There are some restrictions laid out in the developer notes, but whitespace is generally not among them. When it comes to whitespace, the only requirement we have is that lines do not have trailing whitespace, as that trailing whitespace breaks the workflow with git and a bunch of editors/IDEs.

    Of course, that doesn’t mean developers are not allowed to use clang-format. In fact it is encouraged to install clang-format and run the https://github.com/bitcoin/bitcoin/tree/master/contrib/devtools#clang-format-diffpy script to preempt whitespace nitpicking. Though, we have no enforcement guidelines on this.

    There are also some general considerations about style cleanups. While this stylistic change makes sense on its own, it comes at a cost and risk for the project as a whole. The weak motivation for the change does not justify the burden that it places on the project. A burden could be any of the following:

    • Time spent on review
    • Accidental introduction of bugs
    • (Silent) merge conflicts, either in the branch or a backport branch. Those conflicts demand further developer and reviewer time or introduce bugs.

    For more information about refactoring changes and stylistic cleanup, see

    Generally, if the style is not mentioned nor enforced by the developer notes, we leave it up to the original author to pick whatever fits them best personally and then leave it that way until the line is touched for other reasons.

  4. MarcoFalke closed this on Apr 15, 2020

  5. MarcoFalke referenced this in commit 54f812d9d2 on Apr 17, 2020
  6. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-23 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me