-1

I have a .clang-tidy file which includes

CheckOptions:
  - { key: readability-identifier-naming.ClassMethodCase, value: CamelCase }
  - { key: readability-identifier-naming.FunctionCase, value: aNy_CasE }

and a test file with this content

test.hpp

class TestClass {
  int myMethod();
};

I would expect the method myMethod to trigger the ClassMethodCase warning, but its not

clang-tidy test.hpp

reports nothing

If I set the FunctionCase option to CamelCase, then it triggers warning.

Why is clang-tidy considering myMethod is a function? Is this a bug or am I misunderstanding something?

4
  • try PrivateMethodCase Commented Apr 10 at 4:50
  • That seems to do the trick. What is the purpose of ClassMethodCase then? Commented Apr 10 at 9:37
  • I don't know, nor do I know what logic is used for fallback if you don't specify. Commented Apr 10 at 13:45
  • Thanks. If you convert the comment to an answer, Ill mark it as resolved Commented Apr 10 at 20:50

2 Answers 2

0

Use readability-identifier-naming.PrivateMethodCase

Sign up to request clarification or add additional context in comments.

Comments

0

ClassMethodCase pertains to static methods, i.e., methods that operate on the class as opposed to an object. I find this naming choice confusing, and the documentation does not clarify it; I discovered the meaning by studying the unit test.

MethodCase pertains to all methods, both static and non-static, so that's what you want in this case.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.