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

Establish consistent code style #9

Open
2 tasks
ahueck opened this issue Sep 7, 2020 · 1 comment
Open
2 tasks

Establish consistent code style #9

ahueck opened this issue Sep 7, 2020 · 1 comment
Labels
enhancement New feature or request long-term Issues will be addressed sometime the future

Comments

@ahueck
Copy link
Contributor

ahueck commented Sep 7, 2020

Currently, the code style is an arbitrary mix of camel case and snake case.

General

Apply clang-tidy to enforce proper naming conventions, see clang-tidy identifier naming.

Style

A good style seems to be Googles configuration (with some modifications), see Google cloud cpp clang-tidy:

  - { key: readability-identifier-naming.NamespaceCase,          value: lower_case }
  - { key: readability-identifier-naming.ClassCase,              value: CamelCase  }
  - { key: readability-identifier-naming.StructCase,             value: CamelCase  }
  - { key: readability-identifier-naming.TemplateParameterCase,  value: CamelCase  }
  - { key: readability-identifier-naming.FunctionCase,           value: aNy_CasE  }
  - { key: readability-identifier-naming.VariableCase,           value: lower_case }
  - { key: readability-identifier-naming.ClassMemberCase,        value: lower_case }
  - { key: readability-identifier-naming.ClassMemberSuffix,      value: _          }
  - { key: readability-identifier-naming.PrivateMemberSuffix,    value: _          }
  - { key: readability-identifier-naming.ProtectedMemberSuffix,  value: _          }
  - { key: readability-identifier-naming.EnumConstantCase,         value: CamelCase }
  - { key: readability-identifier-naming.EnumConstantPrefix,       value: k         }
  - { key: readability-identifier-naming.ConstexprVariableCase,    value: CamelCase }
  - { key: readability-identifier-naming.ConstexprVariablePrefix,  value: k         }
  - { key: readability-identifier-naming.GlobalConstantCase,       value: CamelCase }
  - { key: readability-identifier-naming.GlobalConstantPrefix,     value: k         }
  - { key: readability-identifier-naming.MemberConstantCase,       value: CamelCase }
  - { key: readability-identifier-naming.MemberConstantPrefix,     value: k         }
  - { key: readability-identifier-naming.StaticConstantCase,       value: CamelCase }
  - { key: readability-identifier-naming.StaticConstantPrefix,     value: k         }
  - { key: readability-implicit-bool-conversion.AllowIntegerConditions,  value: 1   }
  - { key: readability-implicit-bool-conversion.AllowPointerConditions,  value: 1   }

Modifications

  • (Class) Member suffix _ -> m_
  • Method case: camelCase
TODO
  • Evaluate out if these modfications make sense.
  • Extend/complete list of modifications as necessary
@ahueck ahueck added enhancement New feature or request long-term Issues will be addressed sometime the future labels Sep 7, 2020
@jplehr
Copy link
Member

jplehr commented Sep 15, 2020

If we decide on a specific code style, I guess it makes sense to add contribution guidelines to the project.
This is desirable in any case, but more so, if there are clear guidelines people (us included) can follow, if they wish to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request long-term Issues will be addressed sometime the future
Projects
None yet
Development

No branches or pull requests

2 participants