ansible/test/utils/shippable/code-smell.sh
Matt Clay 0d46805979 Clean up shebangs for various files.
- Remove shebangs from:
  - ini files
  - unit tests
  - module_utils
  - plugins
  - module_docs_fragments
  - non-executable Makefiles
- Change non-modules from '/usr/bin/python' to '/usr/bin/env python'.
- Change '/bin/env' to '/usr/bin/env'.

Also removed main functions from unit tests (since they no longer
have a shebang) and fixed a python 3 compatibility issue with
update_bundled.py so it does not need to specify a python 2 shebang.

A script was added to check for unexpected shebangs in files.
This script is run during CI on Shippable.
2016-11-02 17:00:27 -07:00

27 lines
789 B
Bash
Executable file

#!/bin/bash -eux
source_root=$(python -c "from os import path; print(path.abspath(path.join(path.dirname('$0'), '../../..')))")
install_deps="${INSTALL_DEPS:-}"
cd "${source_root}"
if [ "${install_deps}" != "" ]; then
apt-add-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports universe'
apt-get update -qq
apt-get install shellcheck
pip install -r "${source_root}/test/utils/shippable/code-smell-requirements.txt" --upgrade
pip list
fi
yamllint .
test/sanity/code-smell/replace-urlopen.sh .
test/sanity/code-smell/use-compat-six.sh lib
test/sanity/code-smell/boilerplate.sh
test/sanity/code-smell/required-and-default-attributes.sh
test/sanity/code-smell/shebang.sh
shellcheck \
test/integration/targets/*/*.sh \
test/utils/shippable/*.sh