forked from jevalenciap/training
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalysis.sh
More file actions
executable file
·81 lines (65 loc) · 2.03 KB
/
analysis.sh
File metadata and controls
executable file
·81 lines (65 loc) · 2.03 KB
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
73
74
75
76
77
78
79
80
81
#!/bin/bash
echo -en "travis_fold:start:analysis\r"
echo "### Analisis sintactico"
#if [ -z "${1+x}" ]; then
# echo "Login no especificado."
# echo "Uso: $0 login"
# exit -1
#else
# login="$1"
#fi
_style()
{
local user="$1"
local dir=build/people/"$user"
local pyfiles=$(find challenges -iname "$user".py)
if [ -n "$pyfiles" ]; then
mkdir -p "$dir"
echo -n " flake8"
command -v flake8 >/dev/null && (flake8 $(echo "$pyfiles")) > "$dir"/flake8.log 2>&1
echo -n " pylint"
command -v pylint >/dev/null && (pylint $(echo "$pyfiles")) > "$dir"/pylint.log 2>&1
fi
local rbfiles=$(find challenges -iname "$user".rb)
if [ -n "$rbfiles" ]; then
mkdir -p "$dir"
echo -n " ruby-lint"
command -v ruby-lint >/dev/null && (ruby-lint $(echo "$rbfiles")) > "$dir"/ruby-lint.log 2>&1
fi
local cfiles=$(find challenges -iname "$user".c)
if [ -n "$cfiles" ]; then
mkdir -p "$dir"
echo -n " splint"
command -v splint >/dev/null && (splint $(echo "$cfiles")) > "$dir"/splint.log 2>&1
fi
local jsfiles=$(find challenges -iname "$user".js)
if [ -n "$jsfiles" ]; then
mkdir -p "$dir"
echo -n " gjslint"
command -v gjslint >/dev/null && (gjslint $(echo "$rbfiles")) > "$dir"/gjslint.log 2>&1
fi
local shfiles=$(find challenges -iname "$user".sh)
if [ -n "$shfiles" ]; then
mkdir -p "$dir"
echo -n " shellcheck"
command -v shellcheck >/dev/null && (shellcheck $(echo "$shfiles")) > "$dir"/shellcheck.log 2>&1
fi
}
_langs()
{
local user="$1"
LANGS=$(find . -iname "$user".* -exec basename {} \; | sort | uniq | cut -d. -f2)
echo $LANGS
}
USERS=$(find challenges -type f | grep -i -v "LINK\|DATA\|OTHERS\|LANG\|SPEC" | rev | cut -d"/" -f1 | rev | cut -d"." -f1 | sort | uniq)
echo -e "> Usuarios:" $USERS "\n"
for u in $USERS; do
echo -n "--> Lenguajes de "$u": "
_langs "$u"
echo -n " Analizando con:"
_style "$u"
echo ""
done
echo -e "\nTamaño en KB de los logs de errores de cada persona"
du -s build/people/* | sort -n
echo -en "travis_fold:end:analysis\r"