2 #**********************************************************************
3 # Copyright (C) 2024 - The Geeqie Team
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #**********************************************************************
23 ## @brief Run clang-tidy on source files.
28 printf "Run clang-tidy on source files.
30 -a --all Process all source files - default is changed files only
31 -f --fix Fix errors where possible
32 -h --help Display this message
44 printf '%d/%d %s\n' "$i" "$total_files" "$file"
45 clang-tidy ${fix+"--fix-errors"} --config-file ./.clang-tidy -p ./build "$file" 2> /dev/null
47 secs_now=$(cut --delimiter='.' --fields=1 < /proc/uptime)
49 elapsed_time=$((secs_now - secs_start))
50 remaining_files=$((total_files - i))
51 average_time=$((elapsed_time / i))
52 estimated_time=$((average_time * remaining_files))
54 printf 'Remaining: %dm:%ds\n' $((estimated_time % 3600 / 60)) $((estimated_time % 60))
57 if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
59 printf '%s\n' "This is not a Geeqie project folder"
63 # if variable fix is defined in this way, clang-tidy gives errors.
81 --) # End of all options.
86 printf 'Unknown option %s\n' "$1" >&2
105 secs_start=$(cut --delimiter='.' --fields=1 < /proc/uptime)
107 if [ "$process_all" -eq 1 ]
109 total_files=$(find src -name "*.cc" | wc --lines)
115 $(find src -name "*.cc" | sort)
118 total_files=$(git diff --name-only ./src/*.cc | wc --lines)
124 $(git diff --name-only ./src/*.cc | sort)