Update to clang-tidy 18

* remove unused variable
* Use clang-18 for ResInsight build
* Update to clang-tidy-18
* Add NOLINTNEXTLINE
This commit is contained in:
Magne Sjaastad authored and GitHub committed 2025-04-14 20:31:11 +02:00
1 parent 89b2de19b4
commit a09a189214
4 files changed
+19 -20

No files matched your search

+6 -7
View File
@@ -56,10 +56,10 @@ jobs:
ri-unit-test-path: "ResInsight-tests",
}
- {
name: "Ubuntu 22.04 clang-16",
os: ubuntu-22.04,
cc: "clang-16",
cxx: "clang++-16",
name: "Ubuntu 24.04 clang-18",
os: ubuntu-24.04,
cc: "clang-18",
cxx: "clang++-18",
build-python-module: true,
execute-unit-tests: true,
execute-pytests: false,
@@ -158,14 +158,13 @@ jobs:
sudo apt-get update --option="APT::Acquire::Retries=3"
sudo apt-get install --option="APT::Acquire::Retries=3" libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev
- name: Install clang-16
- name: Install clang-18
if: contains( matrix.config.cc, 'clang')
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo apt-get upgrade
wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh 16 all
sudo ./llvm.sh 18 all
- name: Install Qt
uses: jurplel/install-qt-action@v4
+12 -11
View File
@@ -17,8 +17,7 @@ env:
jobs:
ResInsight-clang-tidy:
runs-on: ubuntu-22.04
continue-on-error: true
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -29,15 +28,15 @@ jobs:
run: |
sudo apt-get update --option="APT::Acquire::Retries=3"
sudo apt-get install --option="APT::Acquire::Retries=3" libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev
sudo apt-get install clang-tidy-15 clang-format-15
sudo apt-get install clang-tidy-18 clang-format-18
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 5.12.12
version: 6.7.0
dir: "${{ github.workspace }}/Qt/"
cache: true
modules: "qtnetworkauth"
modules: "qtnetworkauth qtcharts"
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
@@ -54,20 +53,22 @@ jobs:
run: |
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux-release -DRESINSIGHT_USE_OPENMP=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
cmake -DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRESINSIGHT_USE_OPENMP=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
mv compile_commands.json compile_commands_original.json
python ../scripts/fix_json_database.py compile_commands_original.json >> compile_commands.json
- name: Run clang-tidy and apply fixes, clang-format after fixes
- name: Run clang-tidy and apply fixes
continue-on-error: true
run: |
cd build
run-clang-tidy-15 -config-file ../ApplicationLibCode/.clang-tidy -fix files ApplicationLibCode
run-clang-tidy-15 -config-file ../GrpcInterface/.clang-tidy -fix files GrpcInterface
run-clang-tidy-18 -config-file ../ApplicationLibCode/.clang-tidy -fix files ApplicationLibCode
run-clang-tidy-18 -config-file ../GrpcInterface/.clang-tidy -fix files GrpcInterface
- name: Run clang-format after clang-tidy
continue-on-error: true
run: |
cd ApplicationLibCode
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-18 -i
cd ../GrpcInterface
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-18 -i
- uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
@@ -79,6 +79,7 @@ void RiuQtChartView::mouseReleaseEvent( QMouseEvent* event )
if ( event->button() == Qt::RightButton )
{
// Skip QtCharts::QChartView::mouseReleaseEvent() to avoid zoom on right mouse button
// NOLINTNEXTLINE: Suppress clang-tidy for the next line
return QGraphicsView::mouseReleaseEvent( event );
}
-2
View File
@@ -4639,7 +4639,6 @@ bool util_mkdir_p(const char *_path) {
int current_pos = 0;
if (!util_is_directory(path)) {
int i = 0;
active_path = (char*)util_calloc(strlen(path) + 1 , sizeof * active_path );
do {
@@ -4647,7 +4646,6 @@ bool util_mkdir_p(const char *_path) {
if (n < strlen(path))
n += 1;
path += n;
i++;
strncpy(active_path , _path , n + current_pos);
active_path[n+current_pos] = '\0';
current_pos += n;