As discussed in aidge#155, it would be nice to setup clang tidy for this project. This can be done in multiple steps :
Defining the clang-tidy options we need, writing the file and adding it to the project. At this point, it will be ready to use by editors with clangd LSP.
This is nice @jeromeh, however no one here has any idea on how clang-tidy works(except you :') ), I would propose that we do it just like clang-format : integrate clang-tidy to the ci of aidge_core with this configuration so that we see the warnings it produces.
Could you also give a command to run clangd-tidy locally ?
Also make sure to use the latest version of clang-tidy (20 I think as we speak):)
Regarding the clang-tidy-base, I don't think that it is ready to be used like this, it needs more discussion about what should be enabled or not.
Could you also give a command to run clangd-tidy locally ?
clang-tidy file.cpp
Assuming there is a compile_commands.json file available in the top-level directory (and a .clang-tidy file, ofc).
(I just tested clang-tidy src/scheduler/Scheduler.cpp and it worked for me)
clangd is the language server, it provides auto-completion, go-to definitions, find references and so on through the language server protocol.
clang-tidy is a linter. It can be used manually on a file : clang-tidy file.cpp or integrated in the build system, but clangd can be configured to to use clang-tidy. When this is done, it automatically applies the clang-tidy checks specified in the project's .clang-tidy file.
It depends on your IDE, but in general, the option "--clang-tidy" should be given to the clangd command. (and you should but the above clang-tidy file, renamed to .clang-tidy, at the top-level directory of your project).
It is a very bad idea to prefix variables with _, because you risk colliding with names reserved for compiler and standard library implementation use
The current code already uses m prefix for member variables, using m_ instead is not that big a change and is already part of a tried naming style (WebKit here)
@jeromeh I see you ve given clang-tidy 18 documentation in the issue, I currently use clang-format 20, do you think you could use clang-tidy 20 instead so we use the same version?