summaryrefslogtreecommitdiff
path: root/test/code-smell/replace-urlopen.sh
blob: 404caf3098002dfcdd6e42814d758a632d298a11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

BASEDIR=${1-"."}

URLLIB_USERS=$(find "$BASEDIR" -name '*.py' -exec grep -H urlopen \{\} \;)
URLLIB_USERS=$(echo "$URLLIB_USERS" | sed '/\(\n\|lib\/ansible\/module_utils\/urls.py\|lib\/ansible\/compat\/six\/_six.py\)/d')
if test -n "$URLLIB_USERS" ; then
  printf "$URLLIB_USERS"
  exit 1
else
  exit 0
fi