IDF Clang Tidy
The IDF Clang Tidy is a tool that uses clang-tidy to run static analysis on your current app.
Warning
This functionality and the toolchain it relies on are still under development. There may be breaking changes before a final release.
Prerequisites
If you have never run this tool before, take the following steps to get this tool prepared.
Run the export scripts (
export.sh/export.bat/ … ) to set up the environment variables.Run
pip install --upgrade pyclangto install this plugin. The extra commands would be activated inidf.pyautomatically.Run
idf_tools.py install xtensa-clangto install the clang-tidy required binariesNote
This toolchain is still under development. After the final release, you don’t have to install them manually.
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-pylater when you callidf.py clang-check.Note
This file would be bundled in future toolchain releases. This is a temporary workaround.
Run the export scripts (
export.sh/export.bat/ … ) again to refresh the environment variables.
Extra Commands
clang-check
Run idf.py 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 idf.py clang-check --help to see the full documentation.
clang-html-report
Run
pip install codereportto install the additional dependency.Run
idf.py clang-html-reportto generate an HTML report in folder<project_dir>/html_reportaccording to thewarnings.txt. Please open the<project_dir>/html_report/index.htmlin 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.