xref: /src/contrib/libfido2/.actions/run-shellcheck (revision febb0da5bf4bc99828ebede7abcb039514ac367a)
1#!/bin/sh -u
2
3# Copyright (c) 2024 Google LLC. All rights reserved.
4# Use of this source code is governed by a BSD-style
5# license that can be found in the LICENSE file.
6# SPDX-License-Identifier: BSD-2-Clause
7
8LIST="$(mktemp)"
9trap 'rm -- $LIST' EXIT
10
11git ls-files | while read -r file; do
12	if head -n1 "$file" | grep -q '^#!.*sh'; then
13		if ! shellcheck -Cnever --norc "$file"; then
14			echo "$file" >> "$LIST"
15		fi
16	fi
17done
18
19[ -s "$LIST" ] && {
20	echo "The following files contain errors:"
21	cat "$LIST"
22	exit 1
23} 1>&2
24
25exit 0
26