forked from ITISFoundation/osparc-simcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codestyle.bash
executable file
·42 lines (35 loc) · 1.06 KB
/
codestyle.bash
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
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o errexit
set -o nounset
set -o pipefail
IFS=$'\n\t'
SRC_DIRECTORY_NAME=${2}
# global config for entire repo
PYLINT_CONFIG="$(git rev-parse --show-toplevel)/.pylintrc"
# used for development (fails on pylint and mypy)
development() {
echo "enforcing codestyle to source_directory=$SRC_DIRECTORY_NAME"
echo "isort"
isort setup.py src/"$SRC_DIRECTORY_NAME" tests
echo "black"
black src/"$SRC_DIRECTORY_NAME" tests/
echo "pylint"
pylint --rcfile="$PYLINT_CONFIG" src/"$SRC_DIRECTORY_NAME" tests/
echo "mypy"
make mypy
}
# invoked by ci as test (also fails on isort and black)
ci() {
echo "enforcing codestyle to source_directory=$SRC_DIRECTORY_NAME"
echo "isort"
isort --check setup.py src/"$SRC_DIRECTORY_NAME" tests
echo "black"
black --check src/"$SRC_DIRECTORY_NAME" tests
echo "pylint ..."
pylint --rcfile="$PYLINT_CONFIG" src/"$SRC_DIRECTORY_NAME" tests/
echo "mypy ..."
make --silent mypy
}
# Allows to call a function based on arguments passed to the script
"$@"