phpmd/phpmd — pull request #232 by addiks (2014-11-25 21:31:56+00:00)
Title: Three new features about references, includes and include-paths

Hello,

i have added three little new features in my fork of phpmd and would like to see them in the real repository:
- Define PHP include-path's in ruleset-xml files.
- Reference other rulesets relative to the defined include-path's.
- Define an explicit filepath to a rule beside it's classname.

I think these features will make it easier to write project-specific rules (and be able to use them in the project's rulesets).

For an better understanding of how these features work, see the test-ruleset below.
**src/test/resources/rulesets/ruleset-refs.xml** :
```xml

First description...

/foo/bar/baz

1

```

**Why i need these features:** I want to sell magento-modules. And because i want to guarantee high-quality code, i want to also ship a central module defining phpmd-rules for my modules (besides other things). I want my customers (or other developers) be able to also test my (and their) code with the rulesets and rules i provide. Also, i want to test the doccomment-descriptions and annotations which is currently not possible with plain phpmd, so i have written my own rules testing the doccomments. I also need to ship these new rules together with the magento-module. In magento, modules are placed in "app/code/[core|community|local]/[VendorName]/[ModuleName]" with app/code/app/code/[core|community|local] as three include-paths. Absolute filepath's are a no-go here as i do not know where in the filesystem the customer has installed his magento-instance. For my rules to be loadable by phpmd i need to add these three folders as include-paths to the phpmd-runtime.
Also i want to have a seperate ruleset for doccomment-checks to be reusable later, which means i need to reference that doccomment-ruleset from the actual used ruleset, both of wich are shipped and placed inside the module. So i need to be able to reference other rulesets relative from one of the include-path's i defined.
As for the third feature (be able to define an explicit filepath for rule-classes beside the classname), that was my first approach to solve this problem which i later replaced by using include-paths because that seams to be the better solution. I did not want to throw away the already implemented feature which might someone else need someday, so i decided to leave it in there.

Of cource i have written a test to cover these three new features and made sure that the tests all run fine.

I'm still very new to contributing to other projects (not only) on github, so please tell me if i did something wrong. :)