1#!/bin/sh
2# SPDX-License-Identifier: BSD-3-Clause
3
4set -e
5
6# The purpose of this script is not to stop on the first checkpatch
7# failure and report at the end instead.
8#
9# Sample invocation:
10# $0 --codespell --strict < PR_SHAs.txt
11main()
12{
13    local failures=0
14    while read -r sha ; do
15        printf '\n    -------------- \n\n'
16        ./scripts/checkpatch.pl $@ -g $sha || failures=$((failures+1))
17    done
18    printf '\n    -------------- \n\n'
19
20    if [ $failures -ne 0 ]; then
21        cat .github/workflows/SPDX-README.md
22    fi
23
24    return $failures
25}
26
27main "$@"
28