Arm Mbed OS support forum

How to activate clang-tidy checks

I don’t know how to activate clang tidy.
I followed the Code linting Documentation and created the .clang-tidy file.
In my code I have a null pointer.

char *a = NULL;

This should be converted to nullptr.
Unfortunately, after compiling, there is no warning or error telling me this.

This is my .clang-tidy file

Checks: '*'
CheckOptions:
- key:             modernize-use-nullptr.NullMacros
value:           NULL,CUSTOM_NULL

I really don’t know how to activate clang-tidy.
As I understand it, I need to check the Clang Tidy box in the settings, create a clang-tidy file in the root of the current project and compile it.

What am I missing?

Are you using visual studio code?

If so, you can use the vscode-clangd extension:

We have it working perfectly with the following options:

The --query-driver part was what was missing for cross compilation. Change the path accordingly.

And the .clang-tidy file: