lovullo / phpqaconfig
PHP QA and development tool configuration for LoVullo Associates.
Installs: 15 094
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 9
Forks: 0
Open Issues: 0
Requires
- friendsofphp/php-cs-fixer: @stable
- phpmd/phpmd: @stable
- phpunit/dbunit: @stable
- phpunit/phpunit: >=4.8.28
- sebastian/phpcpd: @stable
- squizlabs/php_codesniffer: @stable
- dev-master
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.46
- 1.0.45
- 1.0.44
- 1.0.43
- 1.0.42
- 1.0.41
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2021-05-03 12:46:13 UTC
README
Configuration for QA and development tools specific to the coding standards at
LoVullo Associates. This package, combined with lovullo/phpqatools
is meant
to be a base for new PHP projects.
Installation
Simply require it in your project's composer.json
"require-dev": { "lovullo/phpqaconfig": "@stable" }
Or
$ composer require --dev lovullo/phpqaconfig
Usage
Project Setup
Create a build.xml
file in your project root with the following contents:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>
Create a phpunit.xml
file in your project root with the following contents:
<?xml version="1.0" encoding="UTF-8"?> <phpunit verbose="true"> <testsuites> <testsuite name="ProjectName"> <directory suffix="Test.php">tests/</directory> </testsuite> </testsuites> <logging> <log type="coverage-html" target="build/coverage"/> <log type="coverage-clover" target="build/logs/clover.xml"/> <log type="coverage-crap4j" target="build/logs/crap4j.xml"/> <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/> </logging> </phpunit>
See the "Customizing" section below if you have an existing PHPUnit configuration elsewhere.
Development
When developing, use the following ant targets:
- composer
- phpunit
- phpcs
- phpmd
- phpcpd
- phploc
For example:
$ ant phpcs phpmd phpcpd
Continuous Integration
When configuring Continuous Integration (ie. Jenkins), composer
must download
and install this repo before you can run ant
tasks. Add an "Execute Shell"
build step to Jenkins with the following command:
$ composer install -o
Next, add an "Invoke Ant" build step with the following target:
build-qa
This will run check_mergeconflicts
, phplint
, phpunit
, phpcs-ci
,
pdepend
, phpmd-ci
, phpcpd-ci
, phploc-ci
, and phpdox
.
For jobs that need to run quickly and only need a minimal number of QA checks, run the following targets instead:
build-quick
This will run check_mergeconflicts
, phplint
, and phpunit
.
Add additional build targets to your build.xml
file as appropriate for your
particular project.
Customizing
QA Tools Location
The included build.xml
assumes that all the QA tools are installed into
./vendor/bin
. If they are installed elsewhere, provide a toolsdir
property
to their location:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <property name="toolsdir" value="${basedir}/bin/" /> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>
PHP Lint Configuration
By default, the included build.xml
runs php -l
on all PHP files in the project
except for the vendor/
directory in the root of your project. You can override
this setting using the phplintignore
property:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <property name="phplintignore" value="components/**/*,vendor/**/*" /> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>
PHPUnit Configuration
By default, the included build.xml
assumes that there is a phpunit.xml
file
in the same directory as itself. If you already have a phpunit.xml
file
located somewhere else, you can override the configuration as follows:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <property name="phpunitconfig" value="${basedir}/app/" /> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>
PHP_CodeSniffer Configuration
You can customize the files that are ignored in phpcs
checks by specifying
a phpcsignore
property:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <property name="phpcsignore" value="app/,bin/,vendor/,web/" /> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>
By default, only the vendor
directory is excluded from checks.
You can change what PHP_CodeSniffer standard uses by overriding the
phpcsstandard
property:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <property name="phpcsstandard" value="PSR1,PSR2" /> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>
PHPMD Configuration
You can customize the files that are ignored in phpmd
checks by specifying
a phpmdignore
property:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <property name="phpmdignore" value="app,bin,vendor,web" /> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>
By default, only the vendor
directory is excluded from checks.
PHPCPD Configuration
You can customize the files that are ignored in phpcpd
checks by specifying
a phpcpdignore
property:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <property name="phpcpdignore" value="--exclude vendor --exclude app" /> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>
By default, only the vendor
directory is excluded from checks.
phpDox Configuration
<?xml version="1.0" encoding="utf-8" ?> <phpdox xmlns="http://xml.phpdox.net/config" silent="true"> <bootstrap /> <project name="phpdox" source="${basedir}/src" workdir="${basedir}/build/phpdox/xml"> <collector publiconly="false" backend="parser"> <include mask="*.php" /> <inheritance resolve="true" /> </collector> <generator output="${basedir}/build/docs"> <enrich base="${basedir}/build"> <source type="build" /> <source type="phploc"> <file name="logs/phploc.xml" /> </source> <source type="git"> <git binary="git" /> <history enabled="true" limit="15" cache="${phpDox.project.workdir}/gitlog.xml" /> </source> <source type="checkstyle"> <file name="logs/checkstyle.xml" /> </source> <source type="phpunit"> <file name="logs/phpunit" /> </source> <source type="pmd"> <file name="logs/pmd.xml" /> </source> </enrich> <build engine="html" enabled="true" output="html"> <template dir="${phpDox.home}/templates/html" /> <file extension="html" /> </build> </generator> </project> </phpdox>
Disabling QA Checks
If you do not want certain QA tools to run for a project, add one or more of
the following disable
properties prior to including the base build.xml
file:
<?xml version="1.0" encoding="utf-8"?> <project name="project-name"> <property name="disable-phpunit" value="true" /> <property name="disable-pdepend" value="true" /> <property name="disable-phpmd" value="true" /> <property name="disable-phpcs" value="true" /> <property name="disable-phpcpd" value="true" /> <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" /> </project>