@@ -109,6 +109,8 @@ CI=${CI:-'false'}
109109
110110# ### PROCESS #################################################
111111
112+ hasBeenRestarted=" false"
113+
112114# override configs with project configs
113115overridePath=" $projectConfigPath /qaConfig.inc.bash"
114116
@@ -198,20 +200,27 @@ Running PHPStan
198200---------------------
199201"
200202set +e
201- phpNoXdebug -f bin/phpstan -- analyse " $srcDir " " $testsDir " " $binDir " -l7 -c " $phpstanConfigPath "
202- phpStanExitCode=$?
203- # exit code 0 = fine, 1 = ran fine but found errors, else it means it crashed
204- if (( $phpStanExitCode > 0 ))
205- then
206- if (( $phpStanExitCode > 1 ))
203+ set +e
204+ phpStanExitCode=99
205+ while (( phpStanExitCode > 0 ))
206+ do
207+ phpNoXdebug -f bin/phpstan -- analyse " $srcDir " " $testsDir " " $binDir " -l7 -c " $phpstanConfigPath "
208+ phpStanExitCode=$?
209+ set +x
210+ # exit code 0 = fine, 1 = ran fine but found errors, else it means it crashed
211+ if (( phpStanExitCode > 1 ))
207212 then
208213 printf " \n\n\nPHPStan Crashed....\n\nrunning again with debug mode:\n\n\n"
209214 phpNoXdebug -f bin/phpstan -- analyse " $srcDir " " $testsDir " " $binDir " -l7 -c " $phpstanConfigPath " --debug
215+ exit 1
210216 fi
211- exit $phpStanExitCode
212- fi
217+ if (( phpStanExitCode > 0 ))
218+ then
219+ tryAgainOrAbort " PHPStan"
220+ fi
221+ done
213222set -e
214- set +x
223+
215224
216225echo "
217226
@@ -255,7 +264,7 @@ Running PHP Mess Detector
255264"
256265set +e
257266phpMdExitCode=99
258- while [[ " $ phpMdExitCode" != 0 ]]
267+ while (( phpMdExitCode > 0 ))
259268do
260269 phpNoXdebug -f bin/phpmd -- \
261270 " $srcDir " ," $testsDir " ," $binDir " \
269278 | sed -e ' s#\. #\.\n#'
270279 phpMdExitCode=$?
271280 set +x
272- if [[ " 0 " != " $phpMdExitCode " ]]
281+ if (( phpMdExitCode > 0 ))
273282 then
274- printf " \n\nPHP Mess Detector Failed, would you like to try again? (y/n)\n\n"
275- read -n 1 tryAgainOrAbort
276- if [[ " y" != " $tryAgainOrAbort " ]]
277- then
278- printf " \n\nAborting...\n\n"
279- exit 1
280- fi
281- printf " \n\nTrying again, good luck!\n\n"
283+ tryAgainOrAbort " PHP Mess Detector"
282284 fi
283285done
284286set +x
@@ -322,16 +324,26 @@ Running Code Sniffer on src and tests
322324phpNoXdebug -f bin/phpcs -- \
323325 --config-set ignore_warnings_on_exit " $phpcsFailOnWarning "
324326set +x
325- phpNoXdebug -f bin/phpcs -- \
326- --standard=" $phpcsCodingStandardsPath " \
327- --colors \
328- --cache=" $cacheDir " /phpcs.cache \
329- -s \
330- --report-full \
331- --report-summary \
332- " $srcDir " " $testsDir " " $binDir "
333- set +x
327+ set +e
328+ phpcsExitCode=99
329+ while (( phpcsExitCode > 0 ))
330+ do
331+ phpNoXdebug -f bin/phpcs -- \
332+ --standard=" $phpcsCodingStandardsPath " \
333+ --colors \
334+ --cache=" $cacheDir " /phpcs.cache \
335+ -s \
336+ --report-full \
337+ --report-summary \
338+ " $srcDir " " $testsDir " " $binDir "
339+ phpcsExitCode=$?
340+ set +x
341+ if (( phpcsExitCode > 0 ))
342+ then
343+ tryAgainOrAbort " Code Sniffer"
344+ fi
334345
346+ done
335347
336348echo '
337349
@@ -371,6 +383,20 @@ Running Post Hook $projectConfigPath/hookPost.bash
371383 source $projectConfigPath /hookPost.bash
372384fi
373385
386+ if [[ " false" != " $hasBeenRestarted " ]]
387+ then
388+ echo "
389+
390+ ####################################################################
391+
392+ WARNING - RAN WITH RETRIES
393+
394+ As you have restarted steps in this run,
395+ you should run the whole process again to be sure everything is fine
396+
397+ ####################################################################
398+ "
399+ fi
374400
375401echo "
376402===========================================
0 commit comments