Consider adding a Clang-Tidy configuration to enforce some coding conventions
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
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
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/DirectXMath
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
microsoft/DirectXMath#346 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
microsoft/DirectXMath#342 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
microsoft/DirectXMath#328 ·
-
simplemath
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/DirectXMath#327 · 1 comment ·
-
Project feedback Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
microsoft/DirectXMath#326 · 2 comments ·
All issues in microsoft/DirectXMath
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·