Home

Awesome

PHPQA

PHPQA Analyzer CLI tool

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->

Overview

This project aims to serve as a CLI tool to make easy the use of different PHP tools related to Quality Assurance and code analysis in PHP.

Every analyzer tool handles arguments and options using different formats, the goal of this project is to provide a single way to interact with those projects, you can also set options and arguments using a default configuration file when the project supports it.

This project was originally developed as part of Drupal Console and based on the blog post Write your git hooks in PHP and keep them under git control.

Available Analyzers

Install

Cloning the project

$ git clone git@github.com:jmolivas/phpqa.git
$ cd phpqa
# download dependencies
$ composer install
# make phpqa globally accessible creating a symlink
$ ln -s /path/to/phpqa/bin/phpqa /usr/local/bin/phpqa

Usage

Copy configuration file(s)

$ cd to/project/path
$ phpqa init --project=PROJECT --override
$ phpqa init --global --override
OptionDescription
projectAvailable values php, symfony and drupal.
globalCopy configuration files to user home directory, instead of current working directory.
overrideIf this option is set, files are copied using override flag.

NOTES:

Analyze a project

$ cd to/project/path
$ phpqa analyze --project=PROJECT --files=FILES
$ phpqa analyze --project=PROJECT --git
OptionDescription
projectAvailable values php, symfony and drupal
filesFiles or directories to analyze.
gitIf this option is set, all files added to git index will be scanned. This is useful when setting executing this tool on a pre-commit git-hook.

NOTES:

Override configuration

This project was built to be fully customizable, you can enable/disable analyzers and modify arguments/options passed to analyzers by updating the phpqa.yml or phpqa.yml.dist file on your project root copied when running init command, or the files ~/.phpqa/php/config.yml, ~/.phpqa/symfony/config.yml or ~/.phpqa/drupal/config.yml copied when running init command using --global option.

Nice to have features

This project is a work-in-progress and needs some love related to code clean up, test coverage and documentation.