Skip to content

Commit

Permalink
Add custom ruleset for PHPMD
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Oct 19, 2017
1 parent 60f585d commit 3ba9bb2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ engines:
enabled: true
phpmd:
enabled: true
checks:
Design/TooManyPublicMethods:
maxmethods: 20
Design/WeightedMethodCount:
maximum: 80
config:
rulesets: rulesets.xml
ratings:
paths:
- "**.inc"
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/.codeclimate.yml export-ignore
/.styleci.yml export-ignore
/.editorconfig export-ignore
/ruleset.xml export-ignore
/*.md export-ignore

# Auto detect text files and perform LF normalization
Expand Down
27 changes: 27 additions & 0 deletions rulesets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<ruleset name="PHPMD rule set for my project" 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>Custom rules for checking my project</description>

<rule ref="rulesets/codesize.xml">
<exclude name="TooManyPublicMethods"/>
</rule>

<rule ref="rulesets/codesize.xml/TooManyPublicMethods">
<properties>
<property name="maxmethods" value="20" />
</properties>
</rule>

<rule ref="rulesets/codesize.xml">
<exclude name="WeightedMethodCount"/>
</rule>

<rule ref="rulesets/codesize.xml/WeightedMethodCount">
<properties>
<property name="maximum" value="80" />
</properties>
</rule>
</ruleset>

0 comments on commit 3ba9bb2

Please sign in to comment.