Wrong formatting settings clang-tidy in C++ template project
Closes CWG-48
Merge request reports
Activity
1 Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,readability-identifier-naming' 1 Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,readability-identifier-naming,readability-braces-around-statements' 2 2 CheckOptions: 3 3 - key: readability-identifier-naming.ClassCase 4 4 value: CamelCase 5 5 - key: readability-identifier-naming.EnumCase 6 6 value: CamelCase 7 - key: readability-identifier-naming.UnionCase 8 value: CamelCase 9 # Within ASTRON no specific casing is used. Feel free to adjust 10 # following casings to camelBack for existing projects or 11 # personal/team preferences. - Comment on lines +9 to +11
It's been a while since I did active C++ development within ASTRON. But we used to have some standards:
- Class names in CamelCase
- (Member) function names in snakeCase
- Class variables start their name with the prefix
its
(ortheir
for static class variables)
Insights may have changed, though. @wever should now about current SKA conventions (which are not necessarily ASTRON's conventions).
In team Schaap we use GoogleStyle, which has its own naming conventions. https://google.github.io/styleguide/cppguide.html#Naming
GoogleStyle is on of the SKA style guides too,
@wever the google style is using CamelCase (or PascalCase) for methods. I can add that to the comment or even set is as a default if we want to go into that direction.
@loose For function names do you mean snake_case or camelBack (sometimes named camelCase)? About the prefixes: if we wont to go into that direction we ofc can add that as well but probably should first decide on a (common) style.
I think referring to a style-guide can't hurt. Google's is quite nice. (I really like they provide rationales for their choices, so you can see whether their reasoning applies to your organization.)
If there is no ASTRON sanctioned style we can make the default Google-style and hope others will start to use the same style. I really like it when code has a consistent style, that makes understanding it a lot easier.
For what it's worth. Here's our (20 year old!) ASTRON coding standard. coding_standard_C++_v2.1.pdf
changed this line in version 2 of the diff
- .editorconfig 0 → 100644
7 end_of_line = lf 8 indent_style = space 9 insert_final_newline = true 10 trim_trailing_whitespace = true 11 indent_size = 4 12 13 # Tab indentation (no size specified) 14 [Makefile] 15 indent_style = tab 16 17 [{CMakeLists.txt,*.cmake,*.rst}] 18 indent_size = 2 19 indent_style = space 20 21 [*.{py,c,h,hpp,cc,cpp}] 22 max_line_length = 80 I agree that the tools are never 100% great, much better that a programmer. In C++ I tend to use trailing
//
orclang-format: off
for the few parts the tool does not work great.I still like 80 characters combined with 4 column tabs. IMO when 80 columns becomes too small it quite often means the indention level is high and that might be a sign your function is too complex. (It somewhat depends on the domain, in team Schaap we iterate over 3 dimensional arrays on a regular basis.)
changed this line in version 3 of the diff
mentioned in commit 75c686ae