forked from GNUsocial/gnu-social
[TOOLS][PHPStan] Make a standalone phpstan executable, which executes inside the docker container
This commit is contained in:
parent
299e893ca9
commit
a6d5752748
@ -1,3 +1,3 @@
|
||||
((nil . ((php-project-root . auto)
|
||||
(phpstan-config-file . (root . "phpstan.neon"))
|
||||
(phpstan-memory-limit . "2G"))))
|
||||
(phpstan-executable . (root . "bin/phpstan"))
|
||||
)
|
||||
|
3
Makefile
3
Makefile
@ -2,7 +2,6 @@ DIR=$(strip $(notdir $(CURDIR))) # Seems a bit hack-ish, but `basename` works di
|
||||
|
||||
translate-container-name = $$(if docker container inspect $(1) > /dev/null 2>&1; then echo $(1); else echo $(1) | sed 'y/_/-/' ; fi)
|
||||
|
||||
|
||||
.PHONY:
|
||||
@if ! docker info > /dev/null; then echo "Docker does not seem to be running"; exit 1; fi
|
||||
|
||||
@ -37,7 +36,7 @@ doc-check:
|
||||
bin/php-doc-check src components plugins
|
||||
|
||||
phpstan: tooling-docker
|
||||
docker exec $(call translate-container-name,tooling_php_1) /var/tooling/phpstan.sh
|
||||
bin/phpstan
|
||||
|
||||
stop-tooling: .PHONY
|
||||
cd docker/tooling && docker-compose down
|
||||
|
11
bin/phpstan
Executable file
11
bin/phpstan
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
translate_container_name () {
|
||||
if docker container inspect "$1" > /dev/null 2>&1; then
|
||||
echo "$1"
|
||||
else
|
||||
echo "$1" | sed 'y/_/-/'
|
||||
fi
|
||||
}
|
||||
|
||||
docker exec "$(translate_container_name tooling_php_1)" /var/tooling/phpstan.sh "$@"
|
@ -2,6 +2,15 @@
|
||||
|
||||
cd /var/www/social || exit 1
|
||||
|
||||
|
||||
ARGS=$(echo "$*" | sed 's#\(/[^/]\+\)*/phpstan\.neon#phpstan.neon#') # Remove absolute path to config file
|
||||
|
||||
rm -rf /var/www/social/var/cache/*
|
||||
PHPSTAN_BOOT_KERNEL=1 vendor/bin/phpstan --ansi --no-interaction --memory-limit=2G analyse
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
PHPSTAN_BOOT_KERNEL=1 vendor/bin/phpstan --ansi --no-interaction --memory-limit=2G analyse
|
||||
else
|
||||
PHPSTAN_BOOT_KERNEL=1 vendor/bin/phpstan $ARGS
|
||||
fi
|
||||
|
||||
rm -rf /var/www/social/var/cache/*
|
||||
|
Loading…
Reference in New Issue
Block a user