From aa16b1a21a9246472dc7f8f4ef94265810475522 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 30 Mar 2018 11:39:29 +0200 Subject: [PATCH] Restructure --- 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 | 5 +++-- Inspection/Php/tests.sh | 14 ++++++++++++++ Inspection/inspect.sh | 2 +- setup.sh | 8 ++++++++ 11 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 Inspection/Php/tests.sh diff --git a/Inspection/Html/attributes.sh b/Inspection/Html/attributes.sh index 4c4ea28..0cf92ba 100644 --- a/Inspection/Html/attributes.sh +++ b/Inspection/Html/attributes.sh @@ -2,7 +2,7 @@ . config.sh -echo "Start html attributes inspection\n" +echo "Start html attributes inspection" # Find empty attributes grep -rln "=\"\"" --include \*.tpl.php ${ROOT_PATH} > ${INSPECTION_PATH}/Modules/html/attributes_empty.log diff --git a/Inspection/Html/tags.sh b/Inspection/Html/tags.sh index aca8d0c..a1138fb 100644 --- a/Inspection/Html/tags.sh +++ b/Inspection/Html/tags.sh @@ -2,7 +2,7 @@ . config.sh -echo "Start html tags inspection\n" +echo "Start html tags inspection" # Html tag inspection TAG[0]="<\/html>" diff --git a/Inspection/Js/security.sh b/Inspection/Js/security.sh index f6042b1..07b83ab 100644 --- a/Inspection/Js/security.sh +++ b/Inspection/Js/security.sh @@ -2,7 +2,7 @@ . config.sh -echo "Start js security inspection\n" +echo "Start js security inspection" # JS code inspection CODE[0]="onload" diff --git a/Inspection/Json/linting.sh b/Inspection/Json/linting.sh index b907251..e12e337 100644 --- a/Inspection/Json/linting.sh +++ b/Inspection/Json/linting.sh @@ -2,6 +2,6 @@ . config.sh -echo "Start json linting inspection\n" +echo "Start json linting inspection" 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 4bc4416..bf6bae7 100644 --- a/Inspection/Php/linting.sh +++ b/Inspection/Php/linting.sh @@ -2,7 +2,7 @@ . config.sh -echo "Start php linting inspection\n" +echo "Start php linting inspection" 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 2a2faa3..60a51f3 100644 --- a/Inspection/Php/security.sh +++ b/Inspection/Php/security.sh @@ -2,7 +2,7 @@ . config.sh -echo "Start php security inspection\n" +echo "Start php security inspection" # PHP code inspection CODE[0]="file_get_content" diff --git a/Inspection/Php/stats.sh b/Inspection/Php/stats.sh index 8e208db..a14c533 100644 --- a/Inspection/Php/stats.sh +++ b/Inspection/Php/stats.sh @@ -2,7 +2,7 @@ . config.sh -echo "Start php stats inspection\n" +echo "Start php stats inspection" php ${TOOLS_PATH}/phploc.phar ${ROOT_PATH}/phpOMS/ > ${INSPECTION_PATH}/Framework/phploc.log php ${TOOLS_PATH}/phploc.phar ${ROOT_PATH}/Modules/ > ${INSPECTION_PATH}/Modules/phploc.log diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index 586d30a..6705570 100644 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -2,7 +2,8 @@ . config.sh -echo "Start php style inspection\n" +echo "Start php style inspection" -php ${TOOLS_PATH}/phpcs.phar ${ROOT_PATH}/phpOMS --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report=full --report-file=/Framework/phpcs.log +php ${TOOLS_PATH}/phpcs.phar ${ROOT_PATH}/phpOMS --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report=full --report-file=${INSPECTION_PATH}/Framework/phpcs.log +php ${TOOLS_PATH}/phpcs.phar ${ROOT_PATH}/phpOMS --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report=full --report-file=${INSPECTION_PATH}/Modules/phpcs.log #php ${TOOLS_PATH}/phpmd.phar ${ROOT_PATH}/phpOMS text ${BUILD_PATH}/Config/phpmd.xml --exclude *tests* --minimumpriority 1 \ No newline at end of file diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh new file mode 100644 index 0000000..d2ccf51 --- /dev/null +++ b/Inspection/Php/tests.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +. config.sh + +echo "Start php unit tests inspection" + +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 "Start php static inspection" + +php ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/phpstan.log +php ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/phpstan.log +php ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 ${ROOT_PATH}/Model > ${INSPECTION_PATH}/Model/phpstan.log +php ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/phpstan.log \ No newline at end of file diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index 7523d6b..58a45a8 100644 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -12,7 +12,7 @@ mysql -e 'create database oms;' -u ${DB_USER} -p${DB_PASSWORD} #. Js/build.sh # Executing unit tests -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 +. ${BUILD_PATH}/Inspection/Php/tests.sh # Stats & metrics . ${BUILD_PATH}/Inspection/Php/stats.sh diff --git a/setup.sh b/setup.sh index 783be20..9242c9a 100644 --- a/setup.sh +++ b/setup.sh @@ -2,6 +2,8 @@ . config.sh +echo "Remove old setup" + # Previous cleanup rm -r -f ${ROOT_PATH} rm -r -f ${BASE_PATH}/Website @@ -15,6 +17,8 @@ mkdir -p ${INSPECTION_PATH} cd ${BASE_PATH} +echo "Setup repositories" + # Create git repositories for i in "${GITHUB_URL[@]}" do @@ -25,6 +29,8 @@ cd ${ROOT_PATH} git submodule update --init --recursive git submodule foreach git checkout develop +echo "Setup build output" + # Creating directories for inspection mkdir -p ${INSPECTION_PATH}/logs mkdir -p ${INSPECTION_PATH}/Framework/logs @@ -59,6 +65,8 @@ mkdir -p ${TOOLS_PATH} cd ${TOOLS_PATH} +echo "Setup tools" + # Downloading tools wget -nc https://getcomposer.org/composer.phar wget -nc https://phar.phpunit.de/phploc.phar