friendlyanon / cmake-init

The missing CMake project initializer
GNU General Public License v3.0
1.98k stars 75 forks source link

clang-tidy warning due to readability-identifier-naming #111

Open avitase opened 5 months ago

avitase commented 5 months ago

I have created a new project called foo of type "static/shared". During building the project for the first time an error is thrown by clang-tidy due to "invalid case style for type template parameter", although there are no template parameters in the generated example!?

$ cmake --preset=dev && cmake --build --preset=dev
[ 16%] Building CXX object CMakeFiles/foo_foo.dir/source/foo.cpp.o
warning: invalid case style for type template parameter 'expr-type' [readability-identifier-naming]
[ 33%] Linking CXX static library libfoo.a
[ 33%] Built target foo_foo
[ 50%] Building CXX object example/CMakeFiles/empty_example.dir/empty_example.cpp.o
[ 66%] Building CXX object test/CMakeFiles/foo_test.dir/source/foo_test.cpp.o
[ 83%] Linking CXX executable empty_example
[ 83%] Built target empty_example
warning: invalid case style for type template parameter 'expr-type' [readability-identifier-naming]
[100%] Linking CXX executable foo_test
[100%] Built target foo_test

Changing the values of readability-identifier-naming.TemplateParameterCase and readability-identifier-naming.TypeTemplateParameterCase to aNy_CasE fixes this issue but obviously this shouldn't be the solution... Any idea what actually triggers this warning?

friendlyanon commented 5 months ago

Where do these warnings come from? Your output doesn't associate them to a particular line. Are they coming from 3rd party headers? Are you using clang-tidy-14 or a newer version?

avitase commented 5 months ago

I don't know where this error comes from. I haven't changed any of the files from the generated template and the error log shown above is all that I have. I am also confused to not see any line numbers and my best guess is either source/foo.cpp, include/foo/foo.hpp, or the generated foo/foo_export.hpp. However, none of them are using templates. I am running

$ clang-tidy --version
Ubuntu LLVM version 14.0.0

  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: tigerlake

on an Ubuntu 22.04.4.

Btw, setting WarningAsErrors to '*' in the .clang-tidy configuration file let the build fail, therefore I would say that this is a genuine "warning" from clang-tidy.