From 2377cfe479b20432f7a850e58e53450fe4ffa018 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 19 Mar 2019 21:17:53 +0100 Subject: [PATCH] Add inspections --- Inspection/Js/security.sh | 4 ++-- Inspection/Php/linting.sh | 3 +++ Inspection/Php/security.sh | 14 +++++++------- Inspection/Php/stats.sh | 5 +++++ Inspection/Php/style.sh | 6 +++++- setup.sh | 8 ++++++++ 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Inspection/Js/security.sh b/Inspection/Js/security.sh index 07b83ab..e465d63 100755 --- a/Inspection/Js/security.sh +++ b/Inspection/Js/security.sh @@ -32,8 +32,8 @@ CODE[22]="onblur" for i in "${CODE[@]}" do grep -rlni "$i" --include \*.js ${ROOT_PATH}/jsOMS >> ${INSPECTION_PATH}/Framework/critical_js.log - grep -rlni "$i" --include \*.js ${ROOT_PATH}/Modules >> ${INSPECTION_PATH}/Modules/citical_js.log - grep -rlni "$i" --include \*.js ${ROOT_PATH}/Web >> ${INSPECTION_PATH}/Web/citical_js.log + grep -rlni "$i" --include \*.js ${ROOT_PATH}/Modules >> ${INSPECTION_PATH}/Modules/critical_js.log + grep -rlni "$i" --include \*.js ${ROOT_PATH}/Web >> ${INSPECTION_PATH}/Web/critical_js.log done # JS strict type diff --git a/Inspection/Php/linting.sh b/Inspection/Php/linting.sh index bf6bae7..4f11971 100755 --- a/Inspection/Php/linting.sh +++ b/Inspection/Php/linting.sh @@ -7,6 +7,9 @@ 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 +find ${ROOT_PATH}/Web -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 + find ${ROOT_PATH}/Modules -name "*.php" | xargs -L1 php -l > ${INSPECTION_PATH}/logs/temp.log sed '/^No syntax.*/ d' < ${INSPECTION_PATH}/logs/temp.log > ${INSPECTION_PATH}/Modules/linting/linting_php.log diff --git a/Inspection/Php/security.sh b/Inspection/Php/security.sh index ccf3137..ee6a8ef 100755 --- a/Inspection/Php/security.sh +++ b/Inspection/Php/security.sh @@ -44,13 +44,13 @@ touch ${INSPECTION_PATH}/Web/critical_php.log for i in "${CODE[@]}" do grep -rlni "$i" --include \*.php ${ROOT_PATH}/phpOMS >> ${INSPECTION_PATH}/Framework/critical_php.log - grep -rlni "$i" --include \*.php ${ROOT_PATH}/Modules >> ${INSPECTION_PATH}/Modules/citical_php.log - grep -rlni "$i" --include \*.php ${ROOT_PATH}/Model >> ${INSPECTION_PATH}/Model/citical_php.log - grep -rlni "$i" --include \*.php ${ROOT_PATH}/Web >> ${INSPECTION_PATH}/Web/citical_php.log + grep -rlni "$i" --include \*.php ${ROOT_PATH}/Modules >> ${INSPECTION_PATH}/Modules/critical_php.log + grep -rlni "$i" --include \*.php ${ROOT_PATH}/Model >> ${INSPECTION_PATH}/Model/critical_php.log + grep -rlni "$i" --include \*.php ${ROOT_PATH}/Web >> ${INSPECTION_PATH}/Web/critical_php.log done # PHP strict type -grep -r -L "declare\(\ *strict_types\ *=\ *1\ *\);" --include=*.php ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/strict_missing_php.log -grep -r -L "declare\(\ *strict_types\ *=\ *1\ *\);" --include=*.php ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/strict_missing_php.log -grep -r -L "declare\(\ *strict_types\ *=\ *1\ *\);" --include=*.php ${ROOT_PATH}/Model > ${INSPECTION_PATH}/Model/strict_missing_php.log -grep -r -L "declare\(\ *strict_types\ *=\ *1\ *\);" --include=*.php ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/strict_missing_php.log \ No newline at end of file +grep -r -L "declare\(strict_types=1\);" --include=*.php ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/strict_missing_php.log +grep -r -L "declare\(strict_types=1\);" --include=*.php ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/strict_missing_php.log +grep -r -L "declare\(strict_types=1\);" --include=*.php ${ROOT_PATH}/Model > ${INSPECTION_PATH}/Model/strict_missing_php.log +grep -r -L "declare\(strict_types=1\);" --include=*.php ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/strict_missing_php.log \ No newline at end of file diff --git a/Inspection/Php/stats.sh b/Inspection/Php/stats.sh index a14c533..7071932 100755 --- a/Inspection/Php/stats.sh +++ b/Inspection/Php/stats.sh @@ -4,11 +4,16 @@ 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}/Web/ > ${INSPECTION_PATH}/Web/phploc.log php ${TOOLS_PATH}/phploc.phar ${ROOT_PATH}/Modules/ > ${INSPECTION_PATH}/Modules/phploc.log +# php ${TOOLS_PATH}/phpmetrics.phar --report-html=${INSPECTION_PATH}/Framework/metrics/metrics.html ${ROOT_PATH}/phpOMS/ >> ${INSPECTION_PATH}/Framework/build.log php ${TOOLS_PATH}/phpmetrics.phar --report-html=${INSPECTION_PATH}/Modules/metrics/metrics.html ${ROOT_PATH}/Modules/ >> ${INSPECTION_PATH}/Modules/build.log +# php ${TOOLS_PATH}/pdepend.phar --summary-xml=${INSPECTION_PATH}/Framework/pdepend/pdepend.xml --jdepend-chart=${INSPECTION_PATH}/Framework/pdepend/chart.svg --overview-pyramid=${INSPECTION_PATH}/Framework/pdepend/pyramid.svg ${ROOT_PATH}/phpOMS + php ${TOOLS_PATH}/pdepend.phar --summary-xml=${INSPECTION_PATH}/Modules/pdepend/pdepend.xml --jdepend-chart=${INSPECTION_PATH}/Modules/pdepend/chart.svg --overview-pyramid=${INSPECTION_PATH}/Modules/pdepend/pyramid.svg ${ROOT_PATH}/Modules diff --git a/Inspection/Php/style.sh b/Inspection/Php/style.sh index 6705570..bb20be8 100755 --- a/Inspection/Php/style.sh +++ b/Inspection/Php/style.sh @@ -5,5 +5,9 @@ echo "Start php style inspection" 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}/phpcs.phar ${ROOT_PATH}/Web --standard="${BUILD_PATH}/Config/phpcs.xml" -s --report=full --report-file=${INSPECTION_PATH}/Modules/phpcs.log + +php ${TOOLS_PATH}/phpcs.phar ${ROOT_PATH}/Modules --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/setup.sh b/setup.sh index 45988c3..b0169b8 100755 --- a/setup.sh +++ b/setup.sh @@ -70,6 +70,14 @@ mkdir -p ${INSPECTION_PATH}/Modules/phpcpd mkdir -p ${INSPECTION_PATH}/Modules/linting mkdir -p ${INSPECTION_PATH}/Modules/html +mkdir -p ${INSPECTION_PATH}/Web/logs +mkdir -p ${INSPECTION_PATH}/Web/metrics +mkdir -p ${INSPECTION_PATH}/Web/pdepend +mkdir -p ${INSPECTION_PATH}/Web/phpcs +mkdir -p ${INSPECTION_PATH}/Web/phpcpd +mkdir -p ${INSPECTION_PATH}/Web/linting +mkdir -p ${INSPECTION_PATH}/Web/html + mkdir -p ${INSPECTION_PATH}/Framework mkdir -p ${INSPECTION_PATH}/Web mkdir -p ${INSPECTION_PATH}/Model