forked from espressif/esp-idf
Merge branch 'ci/replace_internal_clang-tidy-runner_v5.1' into 'release/v5.1'
ci: replace internal clang-tidy runner with the pypi project (v5.1) See merge request espressif/esp-idf!34361
This commit is contained in:
@@ -56,9 +56,6 @@ variables:
|
||||
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
|
||||
PYTHON_VER: 3.7.10
|
||||
|
||||
CLANG_TIDY_RUNNER_PROJ: 2107 # idf/clang-tidy-runner
|
||||
IDF_BUILD_APPS_PROJ: 2818 # espressif/idf-build-apps
|
||||
|
||||
# Docker images
|
||||
BOT_DOCKER_IMAGE_TAG: ":latest"
|
||||
|
||||
|
@@ -5,23 +5,16 @@ clang_tidy_check:
|
||||
- .rules:patterns:clang_tidy
|
||||
artifacts:
|
||||
paths:
|
||||
- $OUTPUT_DIR
|
||||
- clang_tidy_reports/
|
||||
when: always
|
||||
expire_in: 1 day
|
||||
variables:
|
||||
CLANG_TIDY_DIRS_TXT: ${CI_PROJECT_DIR}/tools/ci/clang_tidy_dirs.txt
|
||||
RULES_FILE: ${CI_PROJECT_DIR}/tools/ci/static-analysis-rules.yml
|
||||
OUTPUT_DIR: ${CI_PROJECT_DIR}/clang_tidy_reports
|
||||
IDF_TOOLCHAIN: clang
|
||||
script:
|
||||
- internal_pip_install $CLANG_TIDY_RUNNER_PROJ pyclang
|
||||
- export PATH=$PATH:$(python -c "import sys; print(sys.executable.rsplit('/', 1)[0])")
|
||||
- dirs=$(cat ${CLANG_TIDY_DIRS_TXT} | while read line; do echo ${CI_PROJECT_DIR}/${line}; done | xargs)
|
||||
- run_cmd idf_clang ${dirs}
|
||||
--output-path ${OUTPUT_DIR}
|
||||
--limit-file ${RULES_FILE}
|
||||
- run_cmd idf_clang_tidy $(cat tools/ci/clang_tidy_dirs.txt | xargs)
|
||||
--output-path clang_tidy_reports
|
||||
--limit-file tools/ci/static-analysis-rules.yml
|
||||
--xtensa-include-dir
|
||||
--run-clang-tidy-py run-clang-tidy
|
||||
|
||||
check_pylint:
|
||||
extends:
|
||||
|
@@ -19,20 +19,12 @@ 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 pyclang`` to install this plugin. The extra commands would be activated in ``idf.py`` automatically.
|
||||
#. Run ``idf_tools.py install esp-clang`` to install the clang-tidy required binaries
|
||||
|
||||
.. note::
|
||||
|
||||
This toolchain is still under development. After the final release, you don't have to install them manually.
|
||||
|
||||
#. Get file from the `llvm repository <https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py>`_ 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 ``idf.py clang-check``. Please don't forget to make the script executable.
|
||||
|
||||
.. 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
|
||||
|
@@ -1 +1,51 @@
|
||||
.. include:: ../../../en/api-guides/tools/idf-clang-tidy.rst
|
||||
******************
|
||||
IDF clang-tidy
|
||||
******************
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
IDF clang-tidy 是使用 `clang-tidy <https://clang.llvm.org/extra/clang-tidy/>`__ 对当前应用程序进行静态分析的工具。
|
||||
|
||||
.. warning::
|
||||
|
||||
IDF clang-tidy 的功能及其依赖的工具链尚在开发中,最终版本发布前可能有重大变更。
|
||||
|
||||
.. only:: CONFIG_IDF_TARGET_ARCH_RISCV
|
||||
|
||||
.. warning::
|
||||
|
||||
当前工具尚不支持基于 RISC-V 的芯片。目前,乐鑫尚未针对 RISC-V 提供基于 clang 的工具链。
|
||||
|
||||
准备工作
|
||||
=============
|
||||
|
||||
初次运行此工具时,请按照以下步骤准备该工具:
|
||||
|
||||
#. 运行 ``idf_tools.py install esp-clang`` 安装 clang-tidy 所需的二进制文件。
|
||||
|
||||
.. note::
|
||||
|
||||
该工具链尚在开发中,最终版本发布后,将无需手动安装工具链。
|
||||
|
||||
#. 再次运行导出脚本(如 ``export.sh``、``export.bat`` 等),刷新环境变量。
|
||||
|
||||
其他命令
|
||||
==============
|
||||
|
||||
``clang-check``
|
||||
---------------
|
||||
|
||||
运行 ``idf.py clang-check`` 可以重新生成编译数据库,并在当前项目文件夹下运行 ``clang-tidy``,所得输出写入 ``<project_dir>/warnings.txt``。
|
||||
|
||||
运行 ``idf.py clang-check --help`` 查看完整文档。
|
||||
|
||||
``clang-html-report``
|
||||
---------------------
|
||||
|
||||
#. 运行 ``pip install codereport`` 安装附加依赖关系。
|
||||
#. 运行 ``idf.py clang-html-report`` 会根据 ``warnings.txt`` 在 ``<project_dir>/html_report`` 文件夹内生成 HTML 报告。请在浏览器中打开 ``<project_dir>/html_report/index.html`` 查看报告。
|
||||
|
||||
错误报告
|
||||
==========
|
||||
|
||||
此工具托管在 `espressif/clang-tidy-runner <https://github.com/espressif/clang-tidy-runner>`__。如遇到任何错误,或有任何功能请求,请通过 `Github issues <https://github.com/espressif/clang-tidy-runner/issues>`__ 提交报告。
|
||||
|
@@ -117,16 +117,6 @@ function retry_failed() {
|
||||
return $exitCode
|
||||
}
|
||||
|
||||
function internal_pip_install() {
|
||||
project=$1
|
||||
package=$2
|
||||
token_name=${3:-${BOT_TOKEN_NAME}}
|
||||
token=${4:-${BOT_TOKEN}}
|
||||
python=${5:-python}
|
||||
|
||||
$python -m pip install --index-url https://${token_name}:${token}@${GITLAB_HTTPS_HOST}/api/v4/projects/${project}/packages/pypi/simple --force-reinstall --no-deps ${package}
|
||||
}
|
||||
|
||||
function join_by {
|
||||
local d=${1-} f=${2-}
|
||||
if shift 2; then
|
||||
|
@@ -16,7 +16,7 @@ esp-idf-kconfig
|
||||
esp-idf-monitor
|
||||
esp-idf-size
|
||||
esp-idf-panic-decoder
|
||||
construct
|
||||
pyclang
|
||||
|
||||
# gdb extensions dependencies
|
||||
freertos_gdb
|
||||
|
Reference in New Issue
Block a user