2

My team is interested in adding a tool to enforce style guidelines for C++. Two of the best options we have researched are clang-tidy and clang-format.

clang-format appears to meet nearly all of our needs, however one thing I have been unable to determine is if there is a way to configure naming conventions with clang-format. This can be done with clang-tidy using readability-identifier-naming.

Is there a similar feature in clang-format?

  • 1
    No, there's not. – 273K Sep 20 '22 at 15:19
  • @273K: Thanks for the quick reply! That's a bit surprising to me. We may be forced to have both a `.clang-format` and `.clang-tidy` file then. – ryansantaana Sep 20 '22 at 15:24
  • 3
    Clang-format is all about local changes to the code in a way that is irrelevant to the compiler. Like changing whitespace. Renaming variables, on the other hand, is a completely different thing, since its impact is potentially very global (think about exported symbols consumed by other libraries, or just multiple files). Clang format also does not warn about any thing, that is what clang-tidy is for. – Sedenion Sep 21 '22 at 05:28
  • The comment up is and should be marked as the answer. – Keivan Jul 21 '23 at 08:50

0 Answers0