karriere / code-quality
Code Quality scripts that can be run via Composer.
Installs: 12 213
Dependents: 0
Suggesters: 0
Security: 0
Stars: 20
Watchers: 10
Forks: 3
Open Issues: 0
Requires
- php: >=7.1
- dg/bypass-finals: ^1.1
- friends-of-phpspec/phpspec-code-coverage: ^4.3
- karriere/phpspec-matchers: ^3.0
- phpmd/phpmd: ^2.6
- phpspec/phpspec: ^5.1 || ^6.0
- squizlabs/php_codesniffer: ^3.3
- symfony/console: ^3.2 || ^4.0
- symfony/process: ^3.2 || ^4.0
Requires (Dev)
- composer/composer: ^1.6
- dev-master
- v5.1.0
- v5.0.0
- v4.2.0
- v4.1.0
- v4.0.0
- v4.0.0-beta.1
- v3.0.0
- v2.0.0
- v2.0.0-beta.1
- v2.0.0-alpha.1
- v1.3.1
- v1.3.0
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.1
- v1.0.0
- v0.2.0
- v0.1.0
- dev-dev/deprecate-package
- dev-feature/ignore-final-classes
- dev-dev/coverage-extension
- dev-bugfix/handle-phpcbf-exit-codes
This package is auto-updated.
Last update: 2020-12-14 11:11:59 UTC
README
❗️ This package is no longer being actively developed. ❗
Code Quality for PHP packages
This package provides code quality scripts that can be run via Composer.
The scripts also work on continous integration (CI) servers like Jenkins.
Used packages
phpspec/phpspec
Used for testing (SpecBDD) the code.
Must be configured with a phpspec.yml
file in your root folder.
We are using the leanphp/phpspec-code-coverage
extension for generating coverage reports.
This extension requires a phpspec-coverage.yml
file in your root folder and Xdebug enabled.
squizlabs/PHP_CodeSniffer
Currently used for checking (linting) and fixing the code.
Sniffs all files in src
directory.
phpmd/phpmd
Used for mess detection.
Runs the defined ruleset (config/phpmd.xml
) on all files in src
directory.
Installation
Run composer require --dev karriere/code-quality
to install this package.
After installing, insert the desired scripts to your composer.json
.
{ "scripts": { "test": "Karriere\\CodeQuality\\SpecificationTest::run", "lint": "Karriere\\CodeQuality\\CodeStyleChecker::run", "fix": "Karriere\\CodeQuality\\CodeStyleFixer::run", "coverage": "Karriere\\CodeQuality\\CodeCoverage::run", "md": "Karriere\\CodeQuality\\MessDetector::run" } }
Usage
You can run a script like this: composer {script} -- {options}
.
If you are using Git-Shell on Windows (or Git-Shell in Intellij Terminal on Windows), call scripts like this:
composer.bat {script}
. Otherwise colors will not work.
You can disable TTY
by adding the --notty
flag (needed for Jenkins).
On Windows platform it's disabled automatically.
composer {script} -- --env=jenkins --notty
Scripts
test
Usage:
test [--] [options]
Options:
--fail Exit with 1 if tests fail.
--notty Disable TTY.
--ptimeout Set process timeout (defaults to 60 seconds).
-v --verbose Increase the verbosity of messages.
coverage
Usage:
coverage [--] [options]
Options:
--env Specifiy the environment. Possible values:
'local': prints output on command-line.
'jenkins': generates a JUnit report file.
--notty Disable TTY.
--ptimeout Set process timeout (defaults to 60 seconds).
lint
Usage:
lint [--] [options]
Options:
--env Specifiy the environment. Possible values:
'local': prints output on command-line.
'jenkins': generates a checkstyle report file.
--fail Exit with 1 if linting fails.
--notty Disable TTY.
--ptimeout Set process timeout (defaults to 60 seconds).
md
Usage:
lint [--] [options]
Options:
--env Specifiy the environment. Possible values:
'local': prints output on command-line.
'jenkins': generates a xml report file.
--notty Disable TTY.
--ptimeout Set process timeout (defaults to 60 seconds).
fix
Usage:
fix [--] [options]
Options:
--notty Disable TTY.
--ptimeout Set process timeout (defaults to 60 seconds).
Using custom matchers
This package integrates karriere/phpspec-matchers.
In order to use the custom matchers defined in this package,
please include the extension configuration in your phpspec.yml
.
FAQ
Why do I have to provide two phpspec configuration files?
The code-coverage-extension slows down the phpspec tests, so we excluded it from the normal configuration file. Keep tests fast!
How do I increase the verbosity of the test
-script output?
Run composer test -- -v
.