summaryrefslogtreecommitdiff
path: root/test/sanity/code-smell/shebang.sh
blob: 0bc77b818dc1a9d2a679be87a20d1bf43a665a00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

grep '^#!' -rIn . \
    --exclude-dir .git \
    --exclude-dir .tox \
    | grep ':1:' | sed 's/:1:/:/' | grep -v -E \
    -e '^\./lib/ansible/modules/' \
    -e '^\./test/integration/targets/[^/]*/library/[^/]*:#!powershell$' \
    -e '^\./test/integration/targets/[^/]*/library/[^/]*:#!/usr/bin/python$' \
    -e '^\./hacking/cherrypick.py:#!/usr/bin/env python3$' \
    -e ':#!/bin/sh$' \
    -e ':#!/bin/bash( -[eux]|$)' \
    -e ':#!/usr/bin/make -f$' \
    -e ':#!/usr/bin/env python$' \
    -e ':#!/usr/bin/env bash$' \
    -e ':#!/usr/bin/env fish$' \

if [ $? -ne 1 ]; then
    echo "One or more file(s) listed above have an unexpected shebang."
    echo "See $0 for the list of acceptable values."
    exit 1
fi