Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Consider adding a Clang-Tidy configuration to enforce some coding conventions #272

Copy link
Copy link
@ozuda

Description

@ozuda
Issue body actions

Take your project DirectXTK as an example, in which you have set these conventions:

PascalCase for class names, methods, functions, and enums.
camelCase for class member variables, struct members
UPPERCASE for preprocessor defines (and nameless enums)

To enforce these naming conventions, you can add readability-* to the checks as shown below:

Checks: >
  -*,
  readability-*

Then add some of these check options:

CheckOptions:
  readability-identifier-naming.ClassCase: 'CamelCase'
  readability-identifier-naming.ClassMethodCase: 'CamelCase'
  readability-identifier-naming.FunctionCase: 'CamelCase'
  readability-identifier-naming.EnumCase: 'CamelCase'
  readability-identifier-naming.ClassMemberCase: 'camelBack'
  readability-identifier-naming.MemberCase: 'camelBack'
  readability-identifier-naming.MacroDefinitionCase: 'UPPER_CASE'
  readability-identifier-naming.EnumConstantCase: 'UPPER_CASE'

Microsoft Visual Studio supports Clang-Tidy and Clang-Format out of the box.

P.S.: while EditorConfig is fine, I think you can enforce more specific code-style conventions, such as east const and west const with Clang-Format.

Using Clang-Tidy (and perhaps also Clang-Format) could help maintain greater code consistency.

Reference:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.