forked from shellhub-io/shellhub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlint-code
executable file
·56 lines (46 loc) · 1.06 KB
/
lint-code
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
#!/bin/sh
usage() {
cat <<EOF
Run code lints under development machine.
Usage:
$0 <mode>
Mode:
go Run golang lint utilities
vue Run vue lint utilities
all Run both golang and vue lints
EOF
exit 1
}
go() {
[ ! -e .revive.toml ] && echo "ERROR: Run the script from the project root." && exit 1
for container in agent api ssh; do
echo "Running Golang linter on $container"
# Run revive on a running container
docker-compose \
-f docker-compose.yml -f docker-compose.dev.yml \
exec $container golangci-lint run ./... && echo "No lint errors found!"
done
}
vue() {
[ ! -d ui ] && echo "ERROR: Run the script from the project root." && exit 1
echo "Running UI lints"
# Run linter on a running container
docker-compose \
-f docker-compose.yml -f docker-compose.dev.yml \
exec ui npm run lint:no-fix
}
case "$1" in
"go")
go
;;
"vue")
vue
;;
"all")
go
vue
;;
*)
usage
;;
esac