Skip to content

Commit

Permalink
[FEATURE] add phpmd and provide a phpmd ruleset (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanti authored Jul 15, 2017
1 parent e3a986d commit ecc7ebb
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 3 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
},
"require": {
"php": ">=5.6",
"phpmd/phpmd": "^2.6",
"phpro/grumphp": "0.*",
"squizlabs/php_codesniffer": "2.* | 3.*",
"pluswerk/grumphp-bom-task": "4.*",
"pluswerk/grumphp-xliff-task": "2.*"
"pluswerk/grumphp-xliff-task": "2.*",
"squizlabs/php_codesniffer": "2.* | 3.*"
}
}
8 changes: 7 additions & 1 deletion grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ parameters:
- "DebuggerUtility"
triggered_by: [php,js,html]
metadata:
blocking: false #show only warnings
blocking: false #show only as warnings
git_commit_message:
matchers:
- /(\[(!!!|WIP)]|)(\[(BUGFIX|FEATURE|TASK|CLEANUP|SECURITY)]|Merge (in|branch '.+' into)) .+/
Expand All @@ -46,6 +46,12 @@ parameters:
plus_bom_fixer:
metadata:
priority: 1
phpmd:
exclude: []
ruleset: ['./vendor/pluswerk/grumphp-config/phpmd-config.xml']
triggered_by: ['php']
metadata:
blocking: false #show only as warnings
extensions:
- PLUS\GrumPHPBomTask\ExtensionLoader
- PLUS\GrumPHPXliffTask\ExtensionLoader
86 changes: 86 additions & 0 deletions phpmd-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0"?>
<ruleset name="Pluswerk phpmd Ruleset"
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>
Pluswerk phpmd Ruleset
</description>

<!-- cleancode -->
<rule ref="rulesets/cleancode.xml"/>

<!-- codesize -->
<rule ref="rulesets/codesize.xml">
<exclude name="CyclomaticComplexity"/>
<exclude name="ExcessiveMethodLength"/>
<exclude name="ExcessiveClassLength"/>
<exclude name="ExcessiveParameterList"/>
<exclude name="ExcessivePublicCount"/>
<exclude name="TooManyMethods"/>
</rule>
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<properties>
<property name="reportLevel" value="8"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
<properties>
<property name="minimum" value="60"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassLength">
<properties>
<property name="minimum" value="400"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList">
<properties>
<property name="minimum" value="5"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessivePublicCount">
<properties>
<property name="minimum" value="30"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyMethods">
<properties>
<property name="maxmethods" value="20"/>
</properties>
</rule>

<!-- controversial -->
<rule ref="rulesets/controversial.xml"/>

<!-- design -->
<rule ref="rulesets/design.xml">
<exclude name="CouplingBetweenObjects"/>
</rule>
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
<properties>
<property name="minimum" value="8"/>
</properties>
</rule>

<!-- naming -->
<rule ref="rulesets/naming.xml">
<exclude name="LongVariable"/>
<exclude name="ShortMethodName"/>
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<property name="maximum" value="30"/>
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortMethodName">
<properties>
<property name="minimum" value="5"/>
</properties>
</rule>

<!-- unusedcode -->
<rule ref="rulesets/unusedcode.xml"/>

</ruleset>

0 comments on commit ecc7ebb

Please sign in to comment.