forbid-script-underscores
1 #!/usr/bin/env bash 2 # 3 # Forbid scripts containing a un underscore in their filename, 4 # (except where this is required, for example Python modules). 5 # 6 # This is a just a matter of style and taste; there are no correctness 7 # implications. 8 9 set -euo pipefail 10 11 # this include stanza is automatically maintained by update-shell-includes 12 common_dir=$(realpath "$0") 13 common_dir=$(dirname "$common_dir") 14 # shellcheck source=maint/common/bash-utils.sh 15 . "$common_dir"/bash-utils.sh 16 17 reject_all_arguments 18 19 shopt -s nullglob 20 21 wrong=() 22 23 for f in maint/*_*; do 24 case "$f" in 25 *.py) ;; 26 *) wrong+=("$f") ;; 27 esac 28 done 29 30 if [ "${wrong[*]}" != '' ]; then 31 fail "We would like script names to have hyphens, not underscores 32 33 Please rename these files: 34 ${wrong[*]} 35 " 36 fi