How to use clang-tidy with Mbed Studio?

How am I supposed to use clang-tidy with Mbed Studio?

I notice a compile_commands.json file located in ~/.config/Mbed Studio/programs/myproject_-329788419; is there a way to get this file path in a portable manner so I can share a pre-commit hook with my team?

Hi Dan,

Apologies for a late reply. The answer is yes. Mbed Studio support linting using clang-tidy. You can find more on how to enable this functionality here: Code linting - IntelliSense | Mbed Studio Documentation

Thanks,
Arek - Studio team

1 Like

Thanks, Arek! Is there any way to kick it off from the mbed command line tool so I can configure it as a precommit hook? The problem is that the compile commands json file seems to be stored in a directory outside the project so using clang-tidy directly fails with compile errors