This commit is contained in:
Dennis Eichhorn 2022-04-23 16:30:47 +02:00
parent ab36b081ba
commit 82a2e71fc3
6 changed files with 22 additions and 52 deletions

View File

@ -173,6 +173,12 @@
"error", "error",
"always-multiline" "always-multiline"
], ],
"max-len": [
"error",
{
"code": 180
}
],
"new-cap": [ "new-cap": [
"error", "error",
{ {

View File

@ -50,7 +50,7 @@
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/> <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/> <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<rule ref="Generic.Commenting.Todo"> <rule ref="Generic.Commenting.Todo">
<severity>3</severity> <severity>0</severity>
</rule> </rule>
<rule ref="Generic.Commenting.Fixme"> <rule ref="Generic.Commenting.Fixme">
<severity>3</severity> <severity>3</severity>
@ -66,7 +66,15 @@
</properties> </properties>
</rule>--> </rule>-->
<rule ref="Generic.Files.ByteOrderMark"/> <rule ref="Generic.Files.ByteOrderMark"/>
<rule ref="Generic.Files.LineLength"> <!--<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="180"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
<exclude-pattern>*Mapper.php</exclude-pattern>
<exclude-pattern>*TDistribution.php</exclude-pattern>
<exclude-pattern>*ChiSquaredDistribution.php</exclude-pattern>
</rule>-->
<rule ref="Generic.Files.OneTraitPerFile"/> <rule ref="Generic.Files.OneTraitPerFile"/>
<rule ref="Generic.Files.OneInterfacePerFile"/> <rule ref="Generic.Files.OneInterfacePerFile"/>
<rule ref="Generic.Files.OneClassPerFile"/> <rule ref="Generic.Files.OneClassPerFile"/>
@ -78,13 +86,6 @@
</rule> </rule>
<rule ref="Generic.Debug.ESLint"/> <rule ref="Generic.Debug.ESLint"/>
<rule ref="Generic.Debug.CSSLint"/> <rule ref="Generic.Debug.CSSLint"/>
<rule ref="Generic.Debug.JSHint"/>
<severity>3</severity>
<properties>
<property name="lineLimit" value="150"/>
<property name="absoluteLineLimit" value="250"/>
</properties>
</rule>
<rule ref="Generic.Formatting.DisallowMultipleStatements"> <rule ref="Generic.Formatting.DisallowMultipleStatements">
<exclude-pattern>*/tests/*</exclude-pattern><!-- inline function definition --> <exclude-pattern>*/tests/*</exclude-pattern><!-- inline function definition -->
</rule> </rule>
@ -115,13 +116,6 @@
<rule ref="Generic.PHP.RequireStrictTypes"/> <rule ref="Generic.PHP.RequireStrictTypes"/>
<rule ref="Generic.NamingConventions.ConstructorName"/> <rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/> <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.NamingConventions.CamelCapsFunctionName">
<severity>3</severity>
<exclude-pattern>*StringUtils.php</exclude-pattern><!-- Implements missing default functions -->
<exclude-pattern>*FinanceFormulas.php</exclude-pattern><!-- Correct name is more important than rule -->
<exclude-pattern>*StockBonds.php</exclude-pattern><!-- Correct name is more important than rule -->
<exclude-pattern>*ExponentialSmoothing.php</exclude-pattern><!-- Correct name is more important than rule -->
</rule>
<rule ref="Generic.PHP.LowerCaseConstant"/> <rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Generic.PHP.NoSilencedErrors"> <rule ref="Generic.PHP.NoSilencedErrors">
<exclude-pattern>*Server.php</exclude-pattern><!-- Socket shouldn't output errors --> <exclude-pattern>*Server.php</exclude-pattern><!-- Socket shouldn't output errors -->
@ -134,7 +128,7 @@
</properties> </properties>
</rule> </rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/> <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"> <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass">
<severity>3</severity> <severity>3</severity>
</rule> </rule>
<rule ref="PEAR.Classes.ClassDeclaration"/> <rule ref="PEAR.Classes.ClassDeclaration"/>
@ -160,12 +154,9 @@
</rule> </rule>
<rule ref="PEAR.Commenting.InlineComment"/> <rule ref="PEAR.Commenting.InlineComment"/>
<rule ref="PEAR.ControlStructures.ControlSignature"/> <rule ref="PEAR.ControlStructures.ControlSignature"/>
<rule ref="PEAR.ControlStructures.MultiLineCondition">
<severity>3</severity>
</rule>
<rule ref="PEAR.Functions.ValidDefaultValue"/> <rule ref="PEAR.Functions.ValidDefaultValue"/>
<rule ref="PSR1.Files.SideEffects"> <rule ref="PSR1.Files.SideEffects"/>
<rule ref="PSR1.Classes.ClassDeclaration"/> <rule ref="PSR1.Classes.ClassDeclaration">
<severity>3</severity> <severity>3</severity>
<exclude-pattern>*Pdf.php</exclude-pattern><!-- Just a wrapper --> <exclude-pattern>*Pdf.php</exclude-pattern><!-- Just a wrapper -->
<exclude-pattern>*Excel.php</exclude-pattern><!-- Just a wrapper --> <exclude-pattern>*Excel.php</exclude-pattern><!-- Just a wrapper -->
@ -223,7 +214,7 @@
<rule ref="Zend.Files.ClosingTag"/> <rule ref="Zend.Files.ClosingTag"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"> <rule ref="Generic.WhiteSpace.ScopeIndent">
<properties> <properties>
<property name="tabIndent" value="true" /> <property name="tabIndent" value="true"/>
</properties> </properties>
<exclude-pattern>*ResponseType.js</exclude-pattern> <exclude-pattern>*ResponseType.js</exclude-pattern>
<exclude-pattern>*HttpUri.js</exclude-pattern> <exclude-pattern>*HttpUri.js</exclude-pattern>

View File

@ -3,16 +3,6 @@
SCRIPT=$(readlink -f "$0") SCRIPT=$(readlink -f "$0")
BPATH=$(dirname "$SCRIPT") BPATH=$(dirname "$SCRIPT")
# html checks
printf "\nHTML checks\n\n"
find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -E '=\"[\#\$\%\^\&\*\(\)\\/\ ]*\"'
find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(\<img)((?!.*?alt=).)*(>)'
find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(<input)((?!.*?type=).)*(>)'
find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(<input|<select|<textarea)((?!.*?name=).)*(>)'
find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(style=)'
find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(value|title|alt|aria\-label)(=\")((?!\<\?).)*(>)'
find ${BPATH}/../../Web ${BPATH}/../../Install ${BPATH}/../../Modules -name "*tpl.php" | xargs -0 grep -P '(\<td\>|\<th\>|\<caption\>|\<label.*?(\"|l)\>)[0-9a-zA-Z\.\?]+)'
# php/js strict checks # php/js strict checks
printf "\nStrict checks\n\n" printf "\nStrict checks\n\n"
grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${BPATH}/../../phpOMS ${BPATH}/../../Web ${BPATH}/../../Modules ${BPATH}/../../Model grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ${BPATH}/../../phpOMS ${BPATH}/../../Web ${BPATH}/../../Modules ${BPATH}/../../Model
@ -31,6 +21,6 @@ printf "\nWhitespace check\n\n"
find ${BPATH}/../../Web ${BPATH}/../../phpOMS ${BPATH}/../../jsOMS ${BPATH}/../../cOMS ${BPATH}/../../Model ${BPATH}/../../Build ${BPATH}/../../Modules \( -name "*.php" -o -name "*.js" -o -name "*.sh" -o -name "*.cpp" -o -name "*.h" -o -name "*.json" \) | xargs -0 grep -P ' $' find ${BPATH}/../../Web ${BPATH}/../../phpOMS ${BPATH}/../../jsOMS ${BPATH}/../../cOMS ${BPATH}/../../Model ${BPATH}/../../Build ${BPATH}/../../Modules \( -name "*.php" -o -name "*.js" -o -name "*.sh" -o -name "*.cpp" -o -name "*.h" -o -name "*.json" \) | xargs -0 grep -P ' $'
# php cs + phpstan + eslint # php cs + phpstan + eslint
./vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" ./vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml"
./vendor/bin/phpstan analyse --autoload-file=phpOMS/Autoloader.php -l 8 -c Build/Config/phpstan.neon ./ ./vendor/bin/phpstan analyse --autoload-file=phpOMS/Autoloader.php -l 8 -c Build/Config/phpstan.neon ./
npx eslint jsOMS/ -c Build/Config/.eslintrc.json npx eslint jsOMS/ -c Build/Config/.eslintrc.json

View File

@ -3,7 +3,7 @@
mkdir -p Build/test mkdir -p Build/test
# php cs + phpstan + eslint file generation # php cs + phpstan + eslint file generation
./vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" -s --report-junit=Build/test/junit_phpcs.xml ./vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml" -s --report-junit=Build/test/junit_phpcs.xml
./vendor/bin/phpstan analyse --autoload-file=phpOMS/Autoloader.php -l 9 -c Build/Config/phpstan.neon --error-format=prettyJson ./ > Build/test/phpstan.json ./vendor/bin/phpstan analyse --autoload-file=phpOMS/Autoloader.php -l 9 -c Build/Config/phpstan.neon --error-format=prettyJson ./ > Build/test/phpstan.json
npx eslint jsOMS/ -c Build/Config/.eslintrc.json -o Build/test/junit_eslint.xml -f junit npx eslint jsOMS/ -c Build/Config/.eslintrc.json -o Build/test/junit_eslint.xml -f junit

View File

@ -1,16 +0,0 @@
#!/bin/bash
. config.sh
echo "#################################################"
echo "Start html inspection"
echo "#################################################"
# Find invalid html
find {ROOT_PATH}/Web {ROOT_PATH}/phpOMS {ROOT_PATH}/Build {ROOT_PATH}/Modules -name "*tpl.php" | xargs grep -E '=\"[\#\$\%\^\&\*\(\)\\/\ ]*\"' > ${INSPECTION_PATH}/Modules/html/invalid_html.log
find {ROOT_PATH}/Web {ROOT_PATH}/phpOMS {ROOT_PATH}/Build {ROOT_PATH}/Modules -name "*tpl.php" | xargs grep -P '(\<img)((?!.*?alt=).)*(>)' >> ${INSPECTION_PATH}/Modules/html/invalid_html.log
find {ROOT_PATH}/Web {ROOT_PATH}/phpOMS {ROOT_PATH}/Build {ROOT_PATH}/Modules -name "*tpl.php" | xargs grep -P '(<input)((?!.*?type=).)*(>)' >> ${INSPECTION_PATH}/Modules/html/invalid_html.log
find {ROOT_PATH}/Web {ROOT_PATH}/phpOMS {ROOT_PATH}/Build {ROOT_PATH}/Modules -name "*tpl.php" | xargs grep -P '(<input|<select|<textarea)((?!.*?name=).)*(>)' >> ${INSPECTION_PATH}/Modules/html/invalid_html.log
find {ROOT_PATH}/Web {ROOT_PATH}/phpOMS {ROOT_PATH}/Build {ROOT_PATH}/Modules -name "*tpl.php" | xargs grep -P '(style=)' >> ${INSPECTION_PATH}/Modules/html/invalid_html.log
find {ROOT_PATH}/Web {ROOT_PATH}/phpOMS {ROOT_PATH}/Build {ROOT_PATH}/Modules -name "*tpl.php" | xargs grep -P '(value|title|alt|aria\-label)(=\")((?!\<\?).)*(>)' >> ${INSPECTION_PATH}/Modules/html/invalid_html.log
find {ROOT_PATH}/Web {ROOT_PATH}/phpOMS {ROOT_PATH}/Build {ROOT_PATH}/Modules -name "*tpl.php" | xargs grep -P '(\<td\>|\<th\>|\<caption\>|\<label.*?(\"|l)\>)[0-9a-zA-Z\.\?]+)' >> ${INSPECTION_PATH}/Modules/html/invalid_html.log

View File

@ -42,7 +42,6 @@ echo "#################################################"
echo "Custom html inspection" echo "Custom html inspection"
echo "#################################################" echo "#################################################"
. ${BUILD_PATH}/Inspection/Html/tags.sh . ${BUILD_PATH}/Inspection/Html/tags.sh
. ${BUILD_PATH}/Inspection/Html/attributes.sh
# Custom php inspections # Custom php inspections
echo "#################################################" echo "#################################################"