-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·54 lines (48 loc) · 1.34 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·54 lines (48 loc) · 1.34 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
#!/bin/bash
set -euo pipefail
RUN_PHPSTAN=false
RUN_PHP_LINT=false
RUN_SHELLCHECK=false
if [[ $# -eq 0 ]]; then
RUN_PHPSTAN=true
RUN_PHP_LINT=true
RUN_SHELLCHECK=true
fi
while [[ $# -gt 0 ]]; do
case "$1" in
-phpstan|--phpstan)
RUN_PHPSTAN=true; shift;;
-phplint|--phplint)
RUN_PHP_LINT=true; shift;;
-shellcheck|--shellcheck)
RUN_SHELLCHECK=true; shift;;
-h|--help)
echo "Usage: $0 [-phpstan] [-phplint] [-shellcheck]"; exit 0;;
*)
echo "Unknown option: $1"; exit 1;;
esac
done
if [[ "$RUN_PHPSTAN" == true ]]; then
if [[ -f vendor/bin/phpstan ]]; then
echo "Running PHPStan static analysis..."
php vendor/bin/phpstan analyse --memory-limit=512M
echo "PHPStan static analysis passed."
else
echo "PHPStan not found. Skipping static analysis."
fi
fi
if [[ "$RUN_PHP_LINT" == true ]]; then
echo "Running PHP syntax checks..."
php -l source/docker.networks/include/Exec.php
php -l source/docker.networks/include/ExecFunctions.php
echo "PHP syntax checks passed."
fi
if [[ "$RUN_SHELLCHECK" == true ]]; then
if command -v shellcheck >/dev/null; then
echo "Running ShellCheck..."
shellcheck build.sh deploy.sh install.sh test.sh build_in_docker.sh source/pkg_build.sh
echo "ShellCheck passed."
else
echo "ShellCheck not found. Skipping shell script lint."
fi
fi