diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-05-27 19:47:25 -0400 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-05-27 19:47:25 -0400 |
commit | bf3667b8b76eefd95e33e32b4f5abbf2de0e2065 (patch) | |
tree | 241b909f0d68f3c0f355ad924375c2fa5b9a19ae /build-aux/lint-generic | |
parent | 42fb27570262b52e2ca889030c621b5f4af76fe1 (diff) | |
parent | 968f7710458f44d5e62d2624461f4e8459c04168 (diff) |
Merge branch 'lukeshu/cover'
Diffstat (limited to 'build-aux/lint-generic')
-rwxr-xr-x | build-aux/lint-generic | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/build-aux/lint-generic b/build-aux/lint-generic index d982527..9bf88dd 100755 --- a/build-aux/lint-generic +++ b/build-aux/lint-generic @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # build-aux/lint-generic - Non-language-specific lint checks # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> @@ -16,12 +16,19 @@ r=0 for filename in "$@"; do # File header ########################################################## - shebang="$(sed -n '1{/^#!/{/^#!\/hint\//q; p;};}' "$filename")" - if [ -x "$filename" ] && [ -z "$shebang" ]; then + shebang="$(sed -n '1{/^#!/p;}' "$filename")" + if [[ -x $filename && (-z $shebang || $shebang == '#!/hint/'*) ]]; then err "$filename" 'is executable but does not have a shebang' - elif [ -n "$shebang" ] && ! [ -x "$filename" ]; then + elif [[ (-n $shebang && $shebang != '#!/hint/'*) && ! -x $filename ]]; then err "$filename" 'has a shebang but is not executable' fi + case "$shebang" in + '') : ;; + '#!/bin/sh') : ;; + '#!/usr/bin/env bash') : ;; + '#!/usr/bin/env python3') : ;; + *) err "$filename" 'has an unrecognized shebang' ;; + esac if ! grep -E -q 'Copyright \(C\) 202[4-9]((-|, )202[5-9])* Luke T. Shumaker' "$filename"; then err "$filename" 'is missing a copyright statement' |