csoellinger / silverstripe-phpmd
Extended mess detection rules from phpmd for SilverStripe applications.
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 2
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- php: ^7.4 || ^8.0
Requires (Dev)
- ergebnis/composer-normalize: ^2
- php-parallel-lint/php-parallel-lint: @stable
- phpmd/phpmd: @stable
- phpstan/extension-installer: ^1
- phpstan/phpstan: @stable
- phpstan/phpstan-deprecation-rules: ^1
- phpstan/phpstan-phpunit: ^1
- phpstan/phpstan-strict-rules: ^1
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.17.0
- squizlabs/php_codesniffer: ^3
- symfony/process: ^5.4
- vimeo/psalm: ^4
README
This repo was heavily inspired and forked from https://github.com/helpfulrobot/chillu-phpmd-silverstripe
Extended mess detection rules from phpmd for SilverStripe (http://silverstripe.org) applications.
The rules make it easier for developers to comply with the SilverStripe Coding Conventions: https://docs.silverstripe.org/en/4/contributing/php_coding_conventions/
It uses mostly standard PHPMD rules, with a few notable changes:
- Excluded
CleanCode/StaticAccess
: Static access is a "feature" in SilverStripe - Replaced
CamelCaseMethodName
withCamelCaseInstanceMethodName
: Static methods with named snake case a "feature" in SilverStripe. - Replaced
CamelCasePropertyName
withCamelCaseInstancePropertyName
: Static properties with snake case are a "feature" in SilverStripe. - Replaced
CamelCaseVariableName
withCamelCaseInstanceVariableName
: Static variable calls with snake case are a "feature" in SilverStripe. - Replaced
UnusedPrivateField
withUnusedInstancePrivateField
: Check to instance fields only. Unused private statics are by design in SilverStripe. - Fixed short name variable rule for $db, $id und $i
- Added class name check cause by SilverStripe design class name should match the file name
Installation
Global installation for usage across projects:
composer global require csoellinger/silverstripe-phpmd
Local installation on an existing project:
composer require --dev csoellinger/silverstripe-phpmd
Usage
For global installations:
~/.composer/vendor/bin/phpmd <my-project> text ~/.composer/vendor/csoellinger/silverstripe-phpmd/silverstripe-ruleset.xml
For local installations:
vendor/bin/phpmd <my-project> text vendor/csoellinger/silverstripe-phpmd/silverstripe-ruleset.xml
For more details, refer to the command line usage guides on phpmd.org.