2017 © Pedro Peláez
 

library phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

image

mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  • Monday, July 24, 2017
  • by mi-schi
  • Repository
  • 3 Watchers
  • 29 Stars
  • 18,050 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 34 Versions
  • 21 % Grown

The README.md

phpmd-extension

GitHub license Build Status Code Coverage Scrutinizer Code Quality Github All Releases, (*1)

Features

Contains extra phpmd rules from clean code book and the best practices of my experiences., (*2)

Installation

Download the phpmd-extension.phar:, (*3)

$ curl -OsL https://github.com/mi-schi/phpmd-extension/releases/download/stable/phpmd-extension.phar

Alternatively you can use tooly-composer-script for installation., (*4)

It is also possible to use composer (not recommended, see #5):, (*5)

composer require mi-schi/phpmd-extension --dev

Usage

  1. 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.
  2. Then execute the mess detection with phpmd-extension.phar [path/to/src] xml [path/to/phpmd.xml]. The phpmd-extension.phar pass all arguments to the basic phpmd command. You don't have to install phpmd. phpmd-extension.phar includes phpmd.

Basic Rules

<ruleset name="basic-rules"
         xmlns="http://pmd.sf.net/ruleset/1.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
                      http://pmd.sf.net/ruleset_xml_schema.xsd"
         xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
    <description>mess detection</description>

    <rule ref="rulesets/cleancode.xml" />
    <rule ref="rulesets/codesize.xml">
        <exclude name="ExcessiveParameterList" />
        <exclude name="ExcessiveMethodLength" />
        <exclude name="ExcessiveClassLength" />
        <exclude name="CyclomaticComplexity" />
    </rule>
    <rule ref="rulesets/codesize.xml/ExcessiveParameterList">
        <properties>
            <property name="minimum" value="4" />
        </properties>
    </rule>
    <rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
        <properties>
            <property name="minimum" value="31" />
            <property name="ignore-whitespace" value="true" />
        </properties>
    </rule>
    <rule ref="rulesets/codesize.xml/ExcessiveClassLength">
        <properties>
            <property name="minimum" value="301" />
            <property name="ignore-whitespace" value="true" />
        </properties>
    </rule>
    <rule ref="rulesets/codesize.xml/CyclomaticComplexity">
        <properties>
            <property name="reportLevel" value="6" />
            <property name="showClassesComplexity" value="true" />
            <property name="showMethodsComplexity" value="true" />
        </properties>
    </rule>
    <rule ref="rulesets/controversial.xml" />
    <rule ref="rulesets/design.xml" />
    <rule ref="rulesets/naming.xml">
        <exclude name="ShortVariable" />
        <exclude name="LongVariable" />
    </rule>
    <rule ref="rulesets/naming.xml/ShortVariable">
        <properties>
            <property name="minimum" value="2" />
        </properties>
    </rule>
    <rule ref="rulesets/naming.xml/LongVariable">
        <properties>
            <property name="maximum" value="30" />
        </properties>
    </rule>
    <rule ref="rulesets/unusedcode.xml" />
</ruleset>

Add extra rules

    <rule ref="../../../../../../rulesets/cleancode.xml" />
    <rule ref="../../../../../../rulesets/naming.xml" />
    <rule ref="../../../../../../rulesets/test.xml" />

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., (*6)

Exclude or customize extra rule

If you don't want the Law-of-Demeter rule MemberPrimaryPrefix exclude it., (*7)

    <rule ref="../../../../../../rulesets/cleancode.xml">
        <exclude name="MemberPrimaryPrefix" />
    </rule>

If you want to customize it, use the following code:, (*8)

    <rule ref="../../../../../../rulesets/cleancode.xml/MemberPrimaryPrefix">
        <properties>
        <property name="maxChainCount" value="3" description="max count of method chains" />
            <property name="allowedPrefixes" value="add,set" description="allowed prefixes for the method train" />
            <property name="delimiter" value="," description="delimiter for explode" />
        </properties>
    </rule>

The Versions

24/07 2017

dev-master

9999999-dev https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

24/07 2017

4.2.1

4.2.1.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

09/02 2017

4.2.0

4.2.0.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

13/12 2016

4.1.2

4.1.2.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

11/10 2016

4.1.1

4.1.1.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

02/10 2016

4.1.0

4.1.0.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

23/09 2016

4.0.3

4.0.3.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

08/09 2016

4.0.2

4.0.2.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

23/08 2016

4.0.1

4.0.1.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

21/08 2016

4.0.0

4.0.0.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

15/08 2016

3.1.2

3.1.2.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

05/08 2016

3.1.1

3.1.1.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

05/08 2016

3.1.0

3.1.0.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

31/07 2016

3.0.0

3.0.0.0 https://github.com/mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

extension phpmd rules mess detection clean code best practices

10/05 2016

2.1.1

2.1.1.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

29/03 2016

2.1.0

2.1.0.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

28/09 2015

2.0.4

2.0.4.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

24/09 2015

2.0.3

2.0.3.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

24/09 2015

2.0.2

2.0.2.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

23/09 2015

2.0.1

2.0.1.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

22/09 2015

2.0.0

2.0.0.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

16/09 2015

1.1.8

1.1.8.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

21/08 2015

1.1.7

1.1.7.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

21/08 2015

1.1.6

1.1.6.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

21/08 2015

1.1.5

1.1.5.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

11/08 2015

1.1.4

1.1.4.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

11/08 2015

1.1.3

1.1.3.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

11/08 2015

1.1.2

1.1.2.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

04/08 2015

1.1.1

1.1.1.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

04/08 2015

1.1.0

1.1.0.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

03/08 2015

1.0.3

1.0.3.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

08/07 2015

1.0.2

1.0.2.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

04/07 2015

1.0.1

1.0.1.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code

30/06 2015

1.0.0

1.0.0.0 https://github.com/mi-schi/phpmd-symfony2

Extended mess detection rules from phpmd for Symfony applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Schindler

symfony2 phpmd rules extends mess detection clean code