soc/intel/xeon_sp: Drop uncore_fill_ssdt
[coreboot2.git] / util / lint / lint-stable-022-clang-format
blob4a602f798a1072382b320f3f1f1a181c7c7616ac
1 #!/usr/bin/env sh
3 # SPDX-License-Identifier: GPL-2.0-only
5 # DESCR: Run clang-format on white-listed directories
7 LINTDIR="$(
8 cd -- "$(dirname "$0")" > /dev/null 2>&1 || return
9 pwd -P
12 # shellcheck source=helper_functions.sh
13 . "${LINTDIR}/helper_functions.sh"
15 # Until we require this by default, we need a list of opted-in directories
16 # If the script isn't looking at a git repository, just exit
17 if [ ! -f .clang-format-scope ] || [ "${IN_GIT_TREE}" -eq 0 ]; then
18 exit 0
21 files_to_check=$(${GIT} log HEAD~..HEAD --format= --name-only $(cat .clang-format-scope) | grep "\.[ch]$")
23 # nothing to do
24 if [ -z "$files_to_check" ]; then
25 exit 0
28 if [ $(clang-format $files_to_check | wc -l) -gt 0 ]; then
29 if [ "$(${GIT} diff --no-prefix HEAD~..HEAD -- $files_to_check | clang-format-diff)" != "" ]; then
30 echo "Coding style mismatch. The following patch fixes it:"
31 ${GIT} diff --no-prefix HEAD~..HEAD -- $files_to_check | clang-format-diff
32 exit 0