+show_help()
+{
+ printf "Run clang-tidy on source files.
+
+-a --all Process all source files - default is changed files only
+-f --fix Fix errors where possible
+-h --help Display this message
+\n\n"
+}
+
+process_file()
+{
+ if [ -z "$file" ]
+ then
+ return
+ fi
+
+ i=$((i + 1))
+ printf '%d/%d %s\n' "$i" "$total_files" "$file"
+ clang-tidy ${fix+"--fix-errors"} --config-file ./.clang-tidy -p ./build "$file" 2> /dev/null
+
+ secs_now=$(cut --delimiter='.' --fields=1 < /proc/uptime)
+
+ elapsed_time=$((secs_now - secs_start))
+ remaining_files=$((total_files - i))
+ average_time=$((elapsed_time / i))
+ estimated_time=$((average_time * remaining_files))
+
+ printf 'Remaining: %dm:%ds\n' $((estimated_time % 3600 / 60)) $((estimated_time % 60))
+}
+