![]() |
VOOZH | about |
Docker image for running PHP QA Tools
3.3K
Docker image for running PHP QA Tools
docker run --rm -u $UID -v $PWD:/app eko3alpha/docker-phpqa --report --ignoredDirs vendor,build,migrations,test
You can also create an alias so you dont have to type that whole command! More information can be found here: Dockerize Commands
OSX:
sudo pico ~/.bash_profile
Ubuntu:
sudo pico ~/.bash_aliases
Then add the following entry, in this case we're calling it "phpqa" you can change it to whatever you want. Make sure to wrap it in single quotes.
alias phpqa='docker run --rm -u "$UID" -v "$PWD:/app" eko3alpha/docker-phpqa'
After you add the entry refresh the profile
source ~/.bash_profile
Now you can use phpqa tools anywhere! Make sure you are in the root directory of your project and then run
phpqa --report
For full documentation please head over to PHP QA Docs
| Command | Description |
|---|---|
phpqa --help | Show help - available options, tools, default values, ... |
phpqa --analyzedDir ./ --buildDir ./build | Analyze current directory and save output to build directory |
phpqa --ignoredDirs build,vendor | Ignore directories |
phpqa --ignoredFiles RoboFile.php | Ignore files |
phpqa --tools phploc,phpcs | Run only selected tools |
phpqa --tools phpmd:1,phpcs:0,phpcpd:0 | Check number of errors and exit code. New in v1.6 |
phpqa --verbose | Show output from executed tools |
phpqa --quiet | Show no output at all |
phpqa --output cli | CLI output instead of creating files in --buildDir |
phpqa --execution no-parallel | Don't use parallelism if --execution != parallel |
phpqa --config ./my-config | Use custom configuration |
phpqa --report | Build html reports |
phpqa tools | Show versions of available tools |
| Tool | --output file (default) - generated files | --output cli |
|---|---|---|
| phploc | phploc.xml | ✓ |
| phpcpd | phpcpd.xml | ✓ |
| phpcs | checkstyle.xml | full report |
| pdepend | pdepend-jdepend.xml, pdepend-summary.xml, pdepend-jdepend.svg, pdepend-pyramid.svg | ✗ |
| phpmd | phpmd.xml | ✓ |
| phpmetrics | phpmetrics.html, phpmetrics.xml | ✓ |
If you want to change the rules for PHPMD first go here and generate your own rules. Below is a sample output
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="pcsg-generated-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>Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/
</description>
<rule ref="rulesets/controversial.xml/Superglobals"/>
<rule ref="rulesets/design.xml/ExitExpression"/>
<rule ref="rulesets/design.xml/EvalExpression"/>
<rule ref="rulesets/design.xml/GotoStatement"/>
<rule ref="rulesets/naming.xml"/>
<rule ref="rulesets/unusedcode.xml"/>
</ruleset>
Once you create your own rule set, copy and paste the XML into a file. In this example we're naming the file
phpmd.rules.xml
PHPQA will search for a YML file named .phpqa.yml in the directory you to run this docker file from. In this YML file there is a section for phpmd
phpmd:
standard: phpmd.rules.xml
Make sure the location of the xml file (phpmd.rules.xml) is relative to .phpqa.yml. Save and run the docker file.
docker run --rm -u $UID -v $PWD:/app eko3alpha/docker-phpqa --report --tools phpmd --verbose
or if you created an alias
phpqa --report --tools phpmd --verbose
Content type
Image
Digest
Size
72 MB
Last updated
about 5 years ago
docker pull sparkfabrik/docker-phpqa