make baseline prompter.

main
Robert 2 years ago
parent 3fcd529ad1
commit 6bb6b01104
  1. 1
      .gitignore
  2. 2
      app/neato_common.php
  3. 2
      app/neato_enc.php
  4. 3
      phpstan.neon.dist
  5. 52
      static_tests.sh

1
.gitignore vendored

@ -8,6 +8,7 @@ neato_deploy.tar.gz
neatoDeploy.phar
neato_deploy.tar.gz.self
phpstan.neon
phpstan-baseline*.neon
composer.lock
app/sumfiles.sig
build/neatoDeploy.phar.pubkey

@ -154,7 +154,7 @@ function make_password($length = 12) {
$did_special_chr = false;
$did_number = false;
srand((double) microtime() * 1000000);
srand((int) microtime() * 1000000);
if (rand(0, 100) > 50) {
$password .= $special[rand(0, 6)];

@ -113,7 +113,7 @@ class enc {
$my_bin = $hex[$c];
$my_hex = bin2hex($my_bin);
$my_dec = hexdec($my_hex);
$ooh = (int) ord($my_dec);
$ooh = (int) ord((string) $my_dec);
if ($ooh + 62 < 255) {
$decoded .= chr($my_dec - 62);
} else {

@ -1,4 +1,7 @@
includes:
- phpstan-baseline.neon
parameters:
level: 4
paths:
- app
- tests

@ -8,4 +8,54 @@ if [ ! -x vendor/bin/phpstan ]; then
fi
fi
./vendor/bin/phpstan analyse
check_file_size() {
# Get the size of the file
local size=$(stat -c%s "phpstan-baseline.neon")
# Check if the file size is zero
if [ "$size" -eq 0 ]; then
return 0
else
current_date=$(date +"%Y-%m-%d_%H_%M")
mv phpstan-baseline.neon phpstan-baseline_$current_date.neon
touch phpstan-baseline.neon
return 1
fi
}
if [ ! -f phpstan-baseline.neon ]; then
read -p "Do you want to Generate-baseline? (yes/empty for default): " choice
case "$choice" in
"yes")
echo "Making baseline..."
command_params="--generate-baseline"
;;
"")
command_params=""
touch phpstan-baseline.neon
;;
*)
command_params=""
;;
esac
else
read -p "What do you want to do to the baseline? (make/delete/empty for default): " choice
case "$choice" in
"delete")
echo "Removing existing baseline..."
check_file_size
command_params=""
;;
"make")
echo "Making new baseline"
check_file_size
command_params="--generate-baseline"
;;
*)
echo "Using existing baseline..."
command_params=""
;;
esac
fi
./vendor/bin/phpstan analyse $@ $command_params
Loading…
Cancel
Save