Merge branch 'master' of gitea:museum-digital/MD_QA

This commit is contained in:
Joshua Ramon Enslin 2024-05-27 16:43:58 +02:00
commit 1abb965047
5 changed files with 48 additions and 35 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 museum-digital
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

19
README.md Normal file
View File

@ -0,0 +1,19 @@
# Quality Assurance Settings for museum-digital
Most of the code used at [museum-digital](https://www.museum-digital.org) is written in PHP. To keep a uniform code style throughout the code, we use [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer).
## Tools used
- [php-codesniffer](https://github.com/squizlabs/PHP_CodeSniffer)
- [PHPStan - PHP Static Analysis Tool](https://github.com/phpstan/phpstan)
- [phpunit](https://phpunit.de/)
## This Repository
This repository serves to collect generally applicable rules, that can be embedded into the specific rule sets of the different projects.
The file [`md_phpcs_rules.xml`](./rules/md_phpcs_rules.xml) contains the main style guide. When rewriting files to fit the uniform style rules, [`md_phpcs_rules_basic.xml`](./rules/md_phpcs_rules_basic.xml) comes in handy as a first step. It contains the same rules, excluding some which require or encourage a more in-depth look at the code (the prohibition of procedural-style calls to mysqli functions is e.g. a good opportunity to check the efficiency of queries).
## License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for the full license text.

View File

@ -1,15 +0,0 @@
* Quality Assurance Settings for museum-digital
Most of the code used at [[https://www.museum-digital.org][museum-digital]] is written in PHP. To keep a uniform code style throughout the code, we use [[https://github.com/squizlabs/PHP_CodeSniffer][PHP Code Sniffer]].
** Tools used
- [[https://github.com/squizlabs/PHP_CodeSniffer][php-codesniffer]]
- [[https://github.com/phpstan/phpstan][PHPStan - PHP Static Analysis Tool]]
- [[https://phpunit.de/][phpunit]]
** This Repository
This repository serves to collect generally applicable rules, that can be embedded into the specific rule sets of the different projects.
The file _md_phpcs_rules.xml_ contains the main style guide. When rewriting files to fit the uniform style rules, _md_phpcs_rules_basic.xml_ comes in handy as a first step. It contains the same rules, excluding some which require or encourage a more in-depth look at the code (the prohibition of procedural-style calls to mysqli functions is e.g. a good opportunity to check the efficiency of queries).

View File

@ -13,30 +13,31 @@
<rule ref='Squiz.Commenting.FunctionComment'/> <rule ref='Squiz.Commenting.FunctionComment'/>
<rule ref='Squiz.Commenting.ClassComment'/> <rule ref='Squiz.Commenting.ClassComment'/>
<rule ref='SlevomatCodingStandard.PHP.UselessParentheses'/> <!-- <rule ref='SlevomatCodingStandard.PHP.UselessParentheses'/>-->
<rule ref='SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking'/> <rule ref='SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking'/>
<!-- <rule ref='SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable'/> --> <!-- <rule ref='SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable'/> -->
<rule ref='SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable'/> <rule ref='SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable'/>
<!-- <rule ref='SlevomatCodingStandard.Variables.UnusedVariable'/> --> <!-- <rule ref='SlevomatCodingStandard.Variables.UnusedVariable'/> -->
<!-- <rule ref='SlevomatCodingStandard.Variables.UselessVariable'/> --> <rule ref='SlevomatCodingStandard.Variables.UselessVariable'/>
<rule ref='SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace'/> <rule ref='SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace'/>
<rule ref='SlevomatCodingStandard.Classes.ConstantSpacing'/> <rule ref='SlevomatCodingStandard.Classes.ConstantSpacing'/>
<rule ref='SlevomatCodingStandard.PHP.TypeCast'/> <rule ref='SlevomatCodingStandard.PHP.TypeCast'/>
<!-- <rule ref='SlevomatCodingStandard.Classes.ClassConstantVisibility'/> --> <rule ref='SlevomatCodingStandard.Classes.ClassConstantVisibility'/>
<rule ref='SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing'/> <rule ref='SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing'/>
<rule ref='SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing'/> <!-- <rule ref='SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing'/> -->
<!--
<rule ref="SlevomatCodingStandard.Classes.ClassStructure"> <rule ref="SlevomatCodingStandard.Classes.ClassStructure">
<properties> <properties>
<property name="groups" type="array"> <property name="groups" type="array">
<element value="uses"/> <element value="uses"/>
<!-- Public constants are first but you don't care about the order of protected or private constants --> Public constants are first but you don't care about the order of protected or private constants
<element value="public constants"/> <element value="public constants"/>
<element value="constants"/> <element value="constants"/>
<!-- You don't care about the order among the properties. The same can be done with "properties" shortcut --> You don't care about the order among the properties. The same can be done with "properties" shortcut
<element value="public static properties, protected static properties, private static properties"/> <element value="public static properties, protected static properties, private static properties"/>
<element value="public properties, protected properties, private properties"/> <element value="public properties, protected properties, private properties"/>
@ -47,6 +48,7 @@
</property> </property>
</properties> </properties>
</rule> </rule>
-->
<!-- <!--
<rule ref='PEAR.ControlStructures.ControlSignature'> <rule ref='PEAR.ControlStructures.ControlSignature'>

View File

@ -100,19 +100,11 @@ rules:
- PHPStan\Rules\VariableVariables\VariableStaticMethodCallRule - PHPStan\Rules\VariableVariables\VariableStaticMethodCallRule
- PHPStan\Rules\VariableVariables\VariableStaticPropertyFetchRule - PHPStan\Rules\VariableVariables\VariableStaticPropertyFetchRule
- PHPStan\Rules\VariableVariables\VariableVariablesRule - PHPStan\Rules\VariableVariables\VariableVariablesRule
- Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullableTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Expressions\NoCompactRule - Ergebnis\PHPStan\Rules\Expressions\NoCompactRule
- Ergebnis\PHPStan\Rules\Expressions\NoErrorSuppressionRule - Ergebnis\PHPStan\Rules\Expressions\NoErrorSuppressionRule
- Ergebnis\PHPStan\Rules\Expressions\NoEvalRule - Ergebnis\PHPStan\Rules\Expressions\NoEvalRule
- Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule - Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule
- Ergebnis\PHPStan\Rules\Functions\NoNullableReturnTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullableTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullDefaultValueRule
- Ergebnis\PHPStan\Rules\Methods\FinalInAbstractClassRule - Ergebnis\PHPStan\Rules\Methods\FinalInAbstractClassRule
- Ergebnis\PHPStan\Rules\Methods\NoNullableReturnTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Methods\NoParameterWithNullableTypeDeclarationRule
- Ergebnis\PHPStan\Rules\Methods\NoParameterWithNullDefaultValueRule
- Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule - Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule
services: services:
@ -147,9 +139,3 @@ services:
tags: tags:
- phpstan.rules.rule - phpstan.rules.rule
-
class: Ergebnis\PHPStan\Rules\Methods\NoParameterWithContainerTypeDeclarationRule
arguments:
interfacesImplementedByContainers: %ergebnis.interfacesImplementedByContainers%
tags:
- phpstan.rules.rule