summaryrefslogtreecommitdiff
path: root/maint/rust-maint-common/forbid-script-underscores
blob: f37f290f22a3e951c9e47ba9712646631a7401a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
#
# Forbid scripts containing a un underscore in their filename,
# (except where this is required, for example Python modules).
#
# This is a just a matter of style and taste; there are no correctness
# implications.

set -euo pipefail

# this include stanza is automatically maintained by update-shell-includes
common_dir=$(realpath "$0")
common_dir=$(dirname "$common_dir")
# shellcheck source=maint/common/bash-utils.sh
. "$common_dir"/bash-utils.sh

reject_all_arguments

shopt -s nullglob

wrong=()

for f in maint/*_*; do
    case "$f" in
	*.py) ;;
	*) wrong+=("$f") ;;
    esac
done

if [ "${wrong[*]}" != '' ]; then
    fail "We would like script names to have hyphens, not underscores

Please rename these files:
  ${wrong[*]}
"
fi