blob: ef5cc92e4c0b0b2c6cb50d019d9dafda6ead5f0e [file] [log] [blame]
afazekas40fcb9b2019-03-08 11:25:11 +01001#!/bin/bash
Attila Fazekasc07edb52019-03-17 15:38:03 +01002
afazekas40fcb9b2019-03-08 11:25:11 +01003cd $(dirname "$(readlink -f "$0")")
4
Attila Fazekasc07edb52019-03-17 15:38:03 +01005AUTOPEP8=`which autopep8 2>/dev/null`
afazekas40fcb9b2019-03-08 11:25:11 +01006
Attila Fazekasc07edb52019-03-17 15:38:03 +01007if [[ -z "$AUTOPEP8" ]]; then
8 AUTOPEP8=`which autopep8-3`
9fi
10
11if [[ -z "$AUTOPEP8" ]]; then
12 echo "Unable to locate autopep8" >&2
13 exit 2
14fi
15
16# isort is not compatible with the default flake8 (H306), maybe flake8-isort
17# isort -rc -sl -fss ../tempest ../setup.py
Masayuki Igawade1153b2019-07-30 18:02:07 +090018$AUTOPEP8 --exit-code --max-line-length=79 --experimental --in-place \
19 -r ../tempest ../setup.py
Attila Fazekasc07edb52019-03-17 15:38:03 +010020ERROR=$?
21
22if [[ $ERROR -eq 0 ]]; then
23 echo "Formatting was not needed." >&2
24 exit 0
25elif [[ $ERROR -eq 1 ]]; then
26 echo "Formatting failed.." >&2
27 exit 1
28else
29 echo "done" >&2
30fi