Download the PHP package mi-schi/phpmd-extension without Composer
On this page you can find all versions of the php package mi-schi/phpmd-extension. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mi-schi/phpmd-extension
More information about mi-schi/phpmd-extension
Files in mi-schi/phpmd-extension
Package phpmd-extension
Short Description Contains extra phpmd rules from clean code book and the best practices of my experiences.
License MIT
Homepage https://github.com/mi-schi/phpmd-extension
Informations about the package phpmd-extension
phpmd-extension
Features
Contains extra phpmd rules from clean code book and the best practices of my experiences.
- CleanCode
- ConditionalExpression - increase readability
- ConstructorNewOperator - decouple classes, see open-close principle
- DataStructureConstants - increase maintainability
- DataStructureMethods - increase extensibility, see single-responsibility principle
- MemberPrimaryPrefix - supports low coupling, increase testability, see law of demeter
- PublicFieldDeclaration - increase maintainability, see encapsulation/information hiding
- ReturnStatement - increase reading rate, increase extensibility
- SwitchStatement - increase extensibility, see open-close principle
- TraitPublicMethod - increase maintainability, see encapsulation/information hiding
- TryStatement - increase readability
- PrivateFieldDeclaration - supports high cohesion, see DRY and single-responsibility principle
- Naming
- ClassNameSuffix - increase extensibility, see single-responsibility principle
- CommentDescription - reduce unused declarations, increase comprehensibility
- MethodName - increase readability, increase comprehensibility
- Test
- NumberOfMocks - increase testability, supports low coupling, see single-responsibility principle
- NumberOfAsserts - increase maintainability, speed up debugging, see single-responsibility principle
- MethodName - increase readability, increase comprehensibility
Installation
Download the phpmd-extension.phar
:
$ curl -OsL https://github.com/mi-schi/phpmd-extension/releases/download/stable/phpmd-extension.phar
Alternatively you can use tooly-composer-script for installation.
It is also possible to use composer (not recommended, see #5):
composer require mi-schi/phpmd-extension --dev
Usage
- Create a
phpmd.xml
file and import the basic rules from phpmd. The example below contains some useful changes. Afterwards you can extend the configuration with rules from this repository. - Then execute the mess detection with
phpmd-extension.phar [path/to/src] xml [path/to/phpmd.xml]
. Thephpmd-extension.phar
pass all arguments to the basic phpmd command. You don't have to install phpmd.phpmd-extension.phar
includes phpmd.
Basic Rules
Add extra rules
You can also customize the rules with own properties or use only specific rules. Just take a look in the xml files. It works as the basic ruleset logic.
Exclude or customize extra rule
If you don't want the Law-of-Demeter rule MemberPrimaryPrefix exclude it.
If you want to customize it, use the following code: