From e458a7a45c40cff0b312e3269fbe09a6fabede43 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Fri, 11 Aug 2023 11:03:52 +0800 Subject: [PATCH] ci: run pylint for files endswith .py, and skip run when no files matched --- .gitlab/ci/static-code-analysis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab/ci/static-code-analysis.yml b/.gitlab/ci/static-code-analysis.yml index 73d12c27ac..212911ecb7 100644 --- a/.gitlab/ci/static-code-analysis.yml +++ b/.gitlab/ci/static-code-analysis.yml @@ -35,10 +35,11 @@ check_pylint: script: - | if [ -n "$CI_MERGE_REQUEST_IID" ]; then - export files=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py files ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} | grep ".py"); + export files=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py files ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} | grep ".py$"); else export files=$(find . -iname "*.py" -print); fi + - if [ -z "$files" ]; then echo "No python files found"; exit 0; fi - run_cmd pylint --exit-zero --load-plugins=pylint_gitlab --output-format=gitlab-codeclimate:pylint.json $files # build stage