Config files for various code quality services

This commit is contained in:
Timothy Warren 2014-08-12 16:40:21 -04:00
parent 0715d814b6
commit ea09367e77
7 changed files with 104 additions and 19 deletions

25
.scrutinizer.yml Normal file
View File

@ -0,0 +1,25 @@
imports:
- php
tools:
external_code_coverage:
timeout: 1000
# PHP
# Don't like PSR standards, not going to get messages for them!
php_code_sniffer: false
php_sim: true
# Can't be used with similarity analyzer
php_cpd: false
php_mess_detector: true
php_pdepend: true
php_loc: true
php_analyzer:
config:
metrics_lack_of_cohesion_methods:
enabled: true
doc_comment_fixes:
enabled: true
php_hhvm: true

27
.travis.yml Normal file
View File

@ -0,0 +1,27 @@
language: php
php:
- 5.5
- 5.6
- hhvm
install:
- composer install
env:
- DB=mysql
- DB=pgsql
before_script:
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS todo_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database todo_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS todo_test;'; fi";
script:
- vendor/bin/phinx migrate -e testing -c tests/phinx/$DB.yml
- mkdir -p build/logs
- cd tests && phpunit --coverage-clover build/logs/clover.xml
after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

View File

@ -10,18 +10,22 @@ build_settings:
- "migrations"
setup:
composer:
action: "install"
env:
APPLICATION_ENV: "development"
shell:
- "cd %BUILD_PATH% && vendor/bin/phinx rollback -e testing -t0"
- "cd %BUILD_PATH% && vendor/bin/phinx migrate -e testing"
test:
php_unit:
config: 'tests/phpunit.xml'
run_from: 'tests'
coverage: '../web/coverage/'
php_mess_detector:
allowed_warnings: 10
rules:
- "unusedcode"
- "naming"
php_docblock_checker:
php_loc:
# php_docblock_checker:
# php_loc:

View File

@ -1,10 +1,10 @@
<?php
// Require base bootstrap file
require_once('../application/third_party/CIUnit/bootstrap_phpunit.php');
require_once(__DIR__ . '/../application/third_party/CIUnit/bootstrap_phpunit.php');
// Require autoloader
require_once('./env/autoloader.php');
require_once(__DIR__ . '/env/autoloader.php');
/**
* Noop Controller

View File

@ -6,30 +6,29 @@
spl_autoload_register(function($class) {
$paths = [
'../application/controllers/',
'../application/models/',
'../application/libraries/',
'../application/core/',
'../system/core/',
'../system/libraries/'
'application/controllers',
'application/models',
'application/libraries',
'application/core',
'system/core',
'system/libraries'
];
foreach($paths as $path)
{
$path = __DIR__ . "/../../{$path}/";
$exact_file = "{$path}{$class}.php";
$lower_file = $path . mb_strtolower($class) . ".php";
if (file_exists($exact_file))
{
require_once($exact_file);
return;
}
elseif (file_exists($lower_file))
if (file_exists($lower_file))
{
require_once($lower_file);
return;
}
else if (file_exists($exact_file))
{
require_once($exact_file);
return;
}
}
});

15
tests/phinx/mysql.yml Normal file
View File

@ -0,0 +1,15 @@
paths:
migrations: %%PHINX_CONFIG_DIR%%/../../migrations
environments:
default_migration_table: phinxlog
default_database: testing
testing:
adapter: mysql
host: localhost
name: todo_test
user: root
pass:
port: 3306
charset: utf8

15
tests/phinx/pgsql.yml Normal file
View File

@ -0,0 +1,15 @@
paths:
migrations: %%PHINX_CONFIG_DIR%%/../../migrations
environments:
default_migration_table: phinxlog
default_database: testing
testing:
adapter: pgsql
host: localhost
name: todo_test
user: postgres
pass:
port: 5432
charset: utf8