Verified Commit fc31a9fa authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Exclude some generated files from clang-tidy run

The generated files don't pass the readability/coding style checks,
but there's nothing much we can do about that, so we just exclude
them from the check by patching compile_commands.json before running
clang-tidy.
parent 4f755351
resourcebasesettings.cpp
designerplugin.cpp
......@@ -9,7 +9,7 @@ build_clazy_clang_tidy:
only:
- merge_requests
before_script:
- zypper install -y clazy
- zypper install -y clazy jq
- git clone --depth=1 https://invent.kde.org/sysadmin/ci-tooling.git $CI_TOOLING
- git clone --depth=1 https://invent.kde.org/sysadmin/repo-metadata.git $CI_TOOLING/repo-metadata
- git clone --depth=1 https://invent.kde.org/sysadmin/kde-build-metadata.git $CI_TOOLING/kde-build-metadata
......@@ -24,7 +24,7 @@ build_clazy_clang_tidy:
- python3 -u $CI_TOOLING/helpers/prepare-dependencies.py --product $PRODUCT --project $PROJECT --branchGroup $BRANCH_GROUP --environment production --platform $PLATFORM --installTo $INSTALL_PREFIX
- python3 -u $CI_TOOLING/helpers/configure-build.py --product $PRODUCT --project $PROJECT --branchGroup $BRANCH_GROUP --platform $PLATFORM --installTo $INSTALL_PREFIX
- python3 -u $CI_TOOLING/helpers/compile-build.py --product $PRODUCT --project $PROJECT --branchGroup $BRANCH_GROUP --platform $PLATFORM --usingInstall $INSTALL_PREFIX
- cd build && run-clang-tidy -j$(nproc) -q
- ./tools/run-clang-tidy.sh $(pwd)/build
variables:
PLATFORM: SUSEQt5.14
BRANCH_GROUP: kf5-qt5
#!/bin/sh
# Copyright (c) 2020 Daniel Vrátil <dvratil@kde.org>
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
# License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this library; see the file COPYING.LIB. If not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
set -xe
BUILDDIR=$1
function sanitize_compile_commands
{
local cc_file=${BUILDDIR}/compile_commands.json
local filter_file=".clang-tidy-ignore"
if [ ! -f "${cc_file}" ]; then
>&2 echo "Couldn't find compile_commands.json"
exit 1
fi
if [ ! -f "${filter_file}" ]; then
return 0
fi
filter_files=$(cat ${filter_file} | tr '\n' '|' | head -c -1)
local cc_bak_file=${cc_file}.bak
mv ${cc_file} ${cc_bak_file}
cat ${cc_bak_file} | jq -r "map(select(.file|test(\"${filter_files}\")|not))" > ${cc_file}
}
sanitize_compile_commands
cd ${BUILDDIR}
run-clang-tidy -j$(nproc) -q
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment