File indexing completed on 2024-05-19 04:19:13

0001 #!/bin/bash
0002 
0003 # SPDX-FileCopyrightText: 2013-2024 by Gilles Caulier, <caulier dot gilles at gmail dot com>
0004 #
0005 # Run Clang tidy lint static analyzer on whole digiKam source code.
0006 #
0007 # If '--nowebupdate' is passed as argument, static analyzer results are just created locally.
0008 #
0009 # SPDX-License-Identifier: BSD-3-Clause
0010 #
0011 
0012 # Halt and catch errors
0013 set -eE
0014 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
0015 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
0016 
0017 . ./common.sh
0018 
0019 checksCPUCores
0020 
0021 ORIG_WD="`pwd`"
0022 REPORT_DIR="${ORIG_WD}/report.tidy"
0023 WEBSITE_DIR="${ORIG_WD}/site"
0024 
0025 # Get active git branches to create report description string
0026 TITLE="digiKam-$(parseGitBranch)$(parseGitHash)"
0027 echo "Clang Tidy Static Analyzer task name: $TITLE"
0028 
0029 # Clean up and prepare to scan.
0030 
0031 rm -fr $REPORT_DIR
0032 rm -fr $WEBSITE_DIR
0033 
0034 mkdir -p $REPORT_DIR
0035 
0036 /usr/share/clang/run-clang-tidy.py -quiet -j$CPU_CORES -p  ../../build/ | tee $REPORT_DIR/clang-tidy.log
0037 
0038 python3 ./clangtidy_visualizer.py $REPORT_DIR/clang-tidy.log
0039 
0040 #rm -f $REPORT_DIR/clang-tidy.log
0041 mv tidy.html $REPORT_DIR/index.html
0042 
0043 if [[ $1 != "--nowebupdate" ]] ; then
0044 
0045     updateReportToWebsite "tidy" $REPORT_DIR $TITLE $(parseGitBranch)
0046 
0047 fi
0048 
0049 cd $ORIG_DIR
0050