From f61be85e5e2e6d701f43447fa6eab9ed1d3d981c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 14 Dec 2019 21:39:50 +0100 Subject: [PATCH] better logging --- Inspection/Html/attributes.sh | 2 ++ Inspection/Html/tags.sh | 2 ++ Inspection/Js/security.sh | 2 ++ Inspection/Json/linting.sh | 2 ++ Inspection/Php/linting.sh | 2 ++ Inspection/Php/security.sh | 2 ++ Inspection/Php/stats.sh | 2 ++ Inspection/Php/style.sh | 2 ++ Inspection/Php/tests.sh | 4 ++++ Inspection/inspect.sh | 7 +++++++ setup.sh | 5 +++++ 11 files changed, 32 insertions(+) diff --git a/Inspection/Html/attributes.sh b/Inspection/Html/attributes.sh index 96d6830..2966498 100755 --- a/Inspection/Html/attributes.sh +++ b/Inspection/Html/attributes.sh @@ -2,7 +2,9 @@ . config.sh +echo "#################################################" echo "Start html attributes inspection" +echo "#################################################" # Find invalid attributes find ${ROOT_PATH} -name "*tpl.php" | xargs grep -E '=\"[\#\$\%\^\&\*\(\)\\/\ ]*\"' > ${INSPECTION_PATH}/Modules/html/attributes_invalid.log diff --git a/Inspection/Html/tags.sh b/Inspection/Html/tags.sh index a1138fb..697b116 100755 --- a/Inspection/Html/tags.sh +++ b/Inspection/Html/tags.sh @@ -2,7 +2,9 @@ . config.sh +echo "#################################################" echo "Start html tags inspection" +echo "#################################################" # Html tag inspection TAG[0]="<\/html>" diff --git a/Inspection/Js/security.sh b/Inspection/Js/security.sh index e465d63..ac7a172 100755 --- a/Inspection/Js/security.sh +++ b/Inspection/Js/security.sh @@ -2,7 +2,9 @@ . config.sh +echo "#################################################" echo "Start js security inspection" +echo "#################################################" # JS code inspection CODE[0]="onload" diff --git a/Inspection/Json/linting.sh b/Inspection/Json/linting.sh index bda6b24..ddf6cba 100755 --- a/Inspection/Json/linting.sh +++ b/Inspection/Json/linting.sh @@ -2,6 +2,8 @@ . config.sh +echo "#################################################" echo "Start json linting inspection" +echo "#################################################" #find ${ROOT_PATH} -name "*.json" | xargs -L1 jsonlint -q > ${INSPECTION_PATH}/Modules/linting/linting_json.log \ No newline at end of file diff --git a/Inspection/Php/linting.sh b/Inspection/Php/linting.sh index 4f11971..3ddd6fd 100755 --- a/Inspection/Php/linting.sh +++ b/Inspection/Php/linting.sh @@ -2,7 +2,9 @@ . config.sh +echo "#################################################" echo "Start php linting inspection" +echo "#################################################" find ${ROOT_PATH}/phpOMS -name "*.php" | xargs -L1 php -l > ${INSPECTION_PATH}/logs/temp.log sed '/^No syntax.*/ d' < ${INSPECTION_PATH}/logs/temp.log > ${INSPECTION_PATH}/Framework/linting/linting_php.log diff --git a/Inspection/Php/security.sh b/Inspection/Php/security.sh index ee6a8ef..4276533 100755 --- a/Inspection/Php/security.sh +++ b/Inspection/Php/security.sh @@ -2,7 +2,9 @@ . config.sh +echo "#################################################" echo "Start php security inspection" +echo "#################################################" # PHP code inspection CODE[0]="file_get_content" diff --git a/Inspection/Php/stats.sh b/Inspection/Php/stats.sh index db79356..1382374 100755 --- a/Inspection/Php/stats.sh +++ b/Inspection/Php/stats.sh @@ -2,7 +2,9 @@ . config.sh +echo "#################################################" echo "Start php stats inspection" +echo "#################################################" # php ${TOOLS_PATH}/phploc.phar ${ROOT_PATH}/phpOMS/ > ${INSPECTION_PATH}/Framework/phploc.log diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index 3a25d03..ff82c14 100755 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -2,7 +2,9 @@ . config.sh +echo "#################################################" echo "Start php style inspection" +echo "#################################################" php ${TOOLS_PATH}/phpcs.phar ${ROOT_PATH}/phpOMS --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report-full=${INSPECTION_PATH}/Framework/phpcs.log --report-junit=${INSPECTION_PATH}/Framework/phpcs.xml diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh index 65bc62a..40caaaa 100755 --- a/Inspection/Php/tests.sh +++ b/Inspection/Php/tests.sh @@ -2,11 +2,15 @@ . config.sh +echo "#################################################" echo "Start php unit tests inspection" +echo "#################################################" php ${TOOLS_PATH}/phpunit.phar -v --configuration ${ROOT_PATH}/tests/phpunit_default.xml --log-junit ${INSPECTION_PATH}/Test/Php/junit_php.xml --testdox-html ${INSPECTION_PATH}/Test/Php/index.html --coverage-html ${INSPECTION_PATH}/Test/Php/coverage --coverage-clover ${INSPECTION_PATH}/Test/Php/coverage.xml > ${INSPECTION_PATH}/Test/Php/phpunit.log +echo "#################################################" echo "Start php static inspection" +echo "#################################################" php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/phpstan.log php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/phpstan.log diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index fb862ce..49ced95 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -13,37 +13,44 @@ mysql -e 'create database oms;' -u ${DB_USER} --password="${DB_PASSWORD}" # Executing unit tests echo "#################################################" echo "PHP tests" +echo "#################################################" . ${BUILD_PATH}/Inspection/Php/tests.sh # Stats & metrics echo "#################################################" echo "PHP stats" +echo "#################################################" . ${BUILD_PATH}/Inspection/Php/stats.sh # Linting echo "#################################################" echo "Json and PHP linting" +echo "#################################################" . ${BUILD_PATH}/Inspection/Php/linting.sh . ${BUILD_PATH}/Inspection/Json/linting.sh # Code style echo "#################################################" echo "PHP coding style" +echo "#################################################" . ${BUILD_PATH}/Inspection/Php/style.sh # Custom html inspections echo "#################################################" echo "Custom html inspection" +echo "#################################################" . ${BUILD_PATH}/Inspection/Html/tags.sh . ${BUILD_PATH}/Inspection/Html/attributes.sh # Custom php inspections echo "#################################################" echo "Custom php inspection" +echo "#################################################" . ${BUILD_PATH}/Inspection/Php/security.sh # Build external test report echo "#################################################" echo "PHP test report" +echo "#################################################" php ${TOOLS_PATH}/testreportgenerator.phar -b ${ROOT_PATH} -l ${BUILD_PATH}/Config/reportLang.php -c ${INSPECTION_PATH}/Test/Php/coverage.xml -u ${INSPECTION_PATH}/Test/Php/junit_php.xml -s ${INSPECTION_PATH}/Test/Php/junit_phpcs.xml -a ${INSPECTION_PATH}/Test/Php/phpstan.json -d ${INSPECTION_PATH}/Test/ReportExternal --version 1.0.0 \ No newline at end of file diff --git a/setup.sh b/setup.sh index d72b929..3cf7599 100755 --- a/setup.sh +++ b/setup.sh @@ -4,6 +4,7 @@ echo "#################################################" echo "Remove old setup" +echo "#################################################" # Previous cleanup rm -r -f ${ROOT_PATH} @@ -20,6 +21,7 @@ cd ${BASE_PATH} echo "#################################################" echo "Setup repositories" +echo "#################################################" # Create git repositories for i in "${GITHUB_URL[@]}" @@ -37,6 +39,7 @@ git submodule foreach git checkout develop echo "#################################################" echo "Setup hooks" +echo "#################################################" # Setup hooks cp ${ROOT_PATH}/Build/Hooks/default.sh ${ROOT_PATH}/.git/hooks/pre-commit @@ -55,6 +58,7 @@ chmod +x ${ROOT_PATH}/.git/modules/cssOMS/hooks/pre-commit echo "#################################################" echo "Setup build output" +echo "#################################################" # Creating directories for inspection mkdir -p ${INSPECTION_PATH}/logs @@ -100,6 +104,7 @@ cd ${TOOLS_PATH} echo "#################################################" echo "Setup tools" +echo "#################################################" # Downloading tools wget --tries=2 -nc https://getcomposer.org/composer.phar