Symfony bundle for code analysis
Gives you consolidated views of analysis results.
It give a view like :
It executes
And parses their report to give a nice view for rapid analysis of your project.
/* app/AppKernel.php */
public function registerBundles()
{
// ...
$bundles[] = new JD\PhpProjectAnalyzerBundle\JDPhpProjectAnalyzerBundle();
// ...
}
# app/config/routing.yml
ppa:
resource: '@JDPhpProjectAnalyzerBundle/Resources/config/routing.yml'
access_control:
# PPA
- { path: "^(/[a-z]{2})?/ppa(/[a-z]*)?", roles: IS_AUTHENTICATED_ANONYMOUSLY }
framework:
translator: { fallback: %locale% }
jd_php_project_analyzer:
title: Php project analyzer
description: It's a ouaaaouhh project !
gitRepositoryURL: https://github.com/jdlabails/PhpProjectAnalyzerBundle
# directory to analyze
srcPath : /home/jd/Dev/ppa/src/JD
# quantitative metric
count : true
# quality metric : copy-paste
cpd : true
# quality metric : code sniffer
cs :
enable: true
standard: PSR2
# security checker
security: true
# quality metric : phpdepend
depend : true
# quality metric : phploc
loc : true
# quality metric : mess detector
md :
enable: true
rules:
cleancode: true
codesize: true
controversial: true
design: true
naming: true
unusedcode: true
# generate phpdoc
docs : true
# testing
test :
enable: false
lib : phpunit # phpunit || atoum
phpunitTestSuite : ppa
# atoumPath : /home/smith/www/projectX/vendor/bin/atoum
# atoumTestDir : /absolute/path/to/your/test/dir
# score
score:
enable: true
csWeight: 100 # between 0 and 100, weighting of code sniffer
testWeight: 100 # between 0 and 100, weighting of testing
locWeight: 100 # between 0 and 100, weighting of code coverage
php app/console assets:install
sudo php app/console ppa:init
cd Resources/_phar
chmod +x update.sh
./update.sh
ppa:analyse:launch ==> launch analysis without web interface
ppa:analyse:read ==> read analysis without web interface. The result is in json
Examples :
Just make a pull request on master
bin/phpcs --standard=PSR2 --extensions=php Entities Manager Command Controller DependencyInjection Traits
bin/simple-phpunit -c phpunit.xml
Put in your composer.json
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
{
"type": "path",
"url": "/path/to/your/project/dir/jdlabails-php-project-analyzer-bundle/"
}
],