VOOZH about

URL: https://hub.docker.com/r/sparkfabrik/docker-phpqa/

⇱ sparkfabrik/docker-phpqa - Docker Image


sparkfabrik/docker-phpqa

By sparkfabrik

Updated about 5 years ago

Docker image for running PHP QA Tools

Image
0

3.3K

sparkfabrik/docker-phpqa repository overview

docker-phpqa

Docker image for running PHP QA Tools

Example

docker run --rm -u $UID -v $PWD:/app eko3alpha/docker-phpqa --report --ignoredDirs vendor,build,migrations,test

Alias

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

Analyze

CommandDescription
phpqa --helpShow help - available options, tools, default values, ...
phpqa --analyzedDir ./ --buildDir ./buildAnalyze current directory and save output to build directory
phpqa --ignoredDirs build,vendorIgnore directories
phpqa --ignoredFiles RoboFile.phpIgnore files
phpqa --tools phploc,phpcsRun only selected tools
phpqa --tools phpmd:1,phpcs:0,phpcpd:0Check number of errors and exit code. New in v1.6
phpqa --verboseShow output from executed tools
phpqa --quietShow no output at all
phpqa --output cliCLI output instead of creating files in --buildDir
phpqa --execution no-parallelDon't use parallelism if --execution != parallel
phpqa --config ./my-configUse custom configuration
phpqa --reportBuild html reports
phpqa toolsShow versions of available tools

Output modes

PHP Mess Detector

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

Tag summary

latest

Content type

Image

Digest

Size

72 MB

Last updated

about 5 years ago

docker pull sparkfabrik/docker-phpqa