File: format.sh

package info (click to toggle)
tempest 1%3A45.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,876 kB
  • sloc: python: 86,749; sh: 174; makefile: 59
file content (30 lines) | stat: -rwxr-xr-x 664 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

cd $(dirname "$(readlink -f "$0")")

AUTOPEP8=`which autopep8 2>/dev/null`

if [[ -z "$AUTOPEP8" ]]; then
    AUTOPEP8=`which autopep8-3`
fi

if [[ -z "$AUTOPEP8" ]]; then
    echo "Unable to locate autopep8" >&2
    exit 2
fi

# isort is not compatible with the default flake8 (H306), maybe flake8-isort
# isort -rc -sl -fss ../tempest ../setup.py
$AUTOPEP8 --exit-code --max-line-length=79 --experimental --in-place \
          -r ../tempest ../setup.py
ERROR=$?

if [[ $ERROR -eq 0 ]]; then
    echo "Formatting was not needed." >&2
    exit 0
elif [[ $ERROR -eq 1 ]]; then
    echo "Formatting failed.." >&2
    exit 1
else
    echo "done" >&2
fi