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

Open
#272 0 comments 0 reactions 0 assignees View on GitHub

@walbourn is already working on this.

Since Sep 7, 2026.

  • #345 by @walbourn — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
tooling

Research direction

Start by reviewing open pull request #345 and the repository's current EditorConfig and coding-style setup. Compare the proposed Clang-Tidy naming checks and possible Clang-Format rules with the project's existing conventions; done means the agreed configuration is added without conflicting with current tooling.

Written by the indexing model from the issue text.

Description

proposal

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:

Dominant language
C++
Stars
1.8k
Forks
262
Avg merge
20h 57m
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DirectXMath

All issues in microsoft/DirectXMath

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.