010PHP / 010php.nl

[DEPRECATED] The 010PHP Website
0 stars 1 forks source link

Remove unused code detected by phpmd #23

Closed reenl closed 8 years ago

reenl commented 8 years ago

Never used it before, but the following command seems to do a pretty good job:

❯ bin/phpmd src/ text cleancode,codesize,controversial,design,naming,unusedcode --exclude Tests
Caroga commented 8 years ago

Looks good. If you could stash it inside a configuration xml file then that would be great.

<?xml version="1.0"?>
<ruleset name="Symfony2 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>
        Custom ruleset.
    </description>

    <rule ref="rulesets/design.xml"/>
    <rule ref="rulesets/unusedcode.xml"/>
    <rule ref="rulesets/codesize.xml"/>
    <rule ref="rulesets/naming.xml"/>

</ruleset>

In app/phpmd.xml or something. This way we can run phpmd src/ text app/phpmd.xml --exclude Tests