afazekas | 40fcb9b | 2019-03-08 11:25:11 +0100 | [diff] [blame] | 1 | #!/bin/bash |
Attila Fazekas | c07edb5 | 2019-03-17 15:38:03 +0100 | [diff] [blame] | 2 | |
afazekas | 40fcb9b | 2019-03-08 11:25:11 +0100 | [diff] [blame] | 3 | cd $(dirname "$(readlink -f "$0")") |
| 4 | |
Attila Fazekas | c07edb5 | 2019-03-17 15:38:03 +0100 | [diff] [blame] | 5 | AUTOPEP8=`which autopep8 2>/dev/null` |
afazekas | 40fcb9b | 2019-03-08 11:25:11 +0100 | [diff] [blame] | 6 | |
Attila Fazekas | c07edb5 | 2019-03-17 15:38:03 +0100 | [diff] [blame] | 7 | if [[ -z "$AUTOPEP8" ]]; then |
| 8 | AUTOPEP8=`which autopep8-3` |
| 9 | fi |
| 10 | |
| 11 | if [[ -z "$AUTOPEP8" ]]; then |
| 12 | echo "Unable to locate autopep8" >&2 |
| 13 | exit 2 |
| 14 | fi |
| 15 | |
| 16 | # isort is not compatible with the default flake8 (H306), maybe flake8-isort |
| 17 | # isort -rc -sl -fss ../tempest ../setup.py |
Masayuki Igawa | de1153b | 2019-07-30 18:02:07 +0900 | [diff] [blame] | 18 | $AUTOPEP8 --exit-code --max-line-length=79 --experimental --in-place \ |
| 19 | -r ../tempest ../setup.py |
Attila Fazekas | c07edb5 | 2019-03-17 15:38:03 +0100 | [diff] [blame] | 20 | ERROR=$? |
| 21 | |
| 22 | if [[ $ERROR -eq 0 ]]; then |
| 23 | echo "Formatting was not needed." >&2 |
| 24 | exit 0 |
| 25 | elif [[ $ERROR -eq 1 ]]; then |
| 26 | echo "Formatting failed.." >&2 |
| 27 | exit 1 |
| 28 | else |
| 29 | echo "done" >&2 |
| 30 | fi |