forked from BlazingDB/blazingsql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.sh
72 lines (60 loc) · 2.11 KB
/
style.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Copyright (c) 2018, NVIDIA CORPORATION.
##########################
# BlazingDB Style Tester #
##########################
# Ignore errors and set path
set +e
PATH=/conda/bin:$PATH
LC_ALL=C.UTF-8
LANG=C.UTF-8
# Activate common conda env
source activate rapids
# Run isort and get results/return code
# TODO: cordova in a near future consider hive.py and context.py
ISORT=`isort --recursive --check-only pyblazing --skip __init__.py --skip context.py --skip hive.py`
ISORT_RETVAL=$?
# Run black and get results/return code
BLACK=`black --check --exclude=__init__.py pyblazing`
BLACK_RETVAL=$?
# Run flake8 and get results/return code
FLAKE=`flake8 --config=pyblazing/.flake8 pyblazing`
FLAKE_RETVAL=$?
# Run flake8-cython and get results/return code
FLAKE_CYTHON=`flake8 --config=pyblazing/.flake8.cython`
FLAKE_CYTHON_RETVAL=$?
# Output results if failure otherwise show pass
if [ "$ISORT_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: isort style check; begin output\n\n"
echo -e "$ISORT"
echo -e "\n\n>>>> FAILED: isort style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: isort style check\n\n"
fi
if [ "$BLACK_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: black style check; begin output\n\n"
echo -e "$BLACK"
echo -e "\n\n>>>> FAILED: black style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: black style check\n\n"
fi
if [ "$FLAKE_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: flake8 style check; begin output\n\n"
echo -e "$FLAKE"
echo -e "\n\n>>>> FAILED: flake8 style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: flake8 style check\n\n"
fi
# TODO: cordova uncomment this when cython files were updated
#if [ "$FLAKE_CYTHON_RETVAL" != "0" ]; then
# echo -e "\n\n>>>> FAILED: flake8-cython style check; begin output\n\n"
# echo -e "$FLAKE_CYTHON"
# echo -e "\n\n>>>> FAILED: flake8-cython style check; end output\n\n"
#else
# echo -e "\n\n>>>> PASSED: flake8-cython style check\n\n"
#fi
#RETVALS=($ISORT_RETVAL $BLACK_RETVAL $FLAKE_RETVAL $FLAKE_CYTHON_RETVAL)
RETVALS=($BLACK_RETVAL $FLAKE_RETVAL)
IFS=$'\n'
RETVAL=`echo "${RETVALS[*]}" | sort -nr | head -n1`
exit $RETVAL