blob: dec8f1cdbeba2bd2696a378ce9b977accf76ac35 [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
18$AUTOPEP8 --exit-code --max-line-length=79 --experimental --in-place -r ../tempest ../setup.py
19ERROR=$?
20
21if [[ $ERROR -eq 0 ]]; then
22 echo "Formatting was not needed." >&2
23 exit 0
24elif [[ $ERROR -eq 1 ]]; then
25 echo "Formatting failed.." >&2
26 exit 1
27else
28 echo "done" >&2
29fi