IDF Clang Tidy

The IDF Clang Tidy is a tool that uses clang-tidy to run static analysis on your current app.


This functionality and the toolchain it relies on are still under development. There may be breaking changes before a final release.


If you have never run this tool before, take the following steps to get this tool prepared.

  1. Run the export scripts ( / export.bat / … ) to set up the environment variables.

  2. Run pip install --upgrade pyclang to install this plugin. The extra commands would be activated in automatically.

  3. Run install xtensa-clang to install the clang-tidy required binaries


    This toolchain is still under development. After the final release, you don’t have to install them manually.

  4. Get file from the llvm repository and add the folder of this script to the $PATH. Or you could pass an optional argument --run-clang-tidy-py later when you call clang-check. Please don’t forget to make the script executable.


    This file would be bundled in future toolchain releases. This is a temporary workaround.

  5. Run the export scripts ( / export.bat / … ) again to refresh the environment variables.

Extra Commands


Run clang-check to re-generate the compilation database and run clang-tidy under your current project folder. The output would be written to <project_dir>/warnings.txt.

Run clang-check --help to see the full documentation.


  1. Run pip install codereport to install the additional dependency.

  2. Run clang-html-report to generate an HTML report in folder <project_dir>/html_report according to the warnings.txt. Please open the <project_dir>/html_report/index.html in your browser to check the report.

Bug Report

This tool is hosted in espressif/clang-tidy-runner. If you faced any bugs or have any feature request, please report them via github issues.