Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vendor/
ansible/
report/
composer.lock
phpunit.xml
phpunit.xml
/.php_cs.cache
96 changes: 96 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
stages:
- build
- analysis
- testing
- reporting

build:composer:
stage: build
image: php:7.1
before_script:
# Install git&ssh
- apt-get update -yqq
- apt-get install openssh-client -yqq > /dev/null
- apt-get install git -yqq > /dev/null

# Setup ssh
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- ssh-keyscan -t rsa git.prod.sup.fdmg.org,$(dig +short git.prod.sup.fdmg.org) >> ~/.ssh/known_hosts
- '[[ -f /.dockerinit ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

# Install extensions for update file manager
- apt-get install -yqq libc-client-dev libkrb5-dev > /dev/null
- docker-php-ext-install zip > /dev/null
- curl --silent --show-error https://getcomposer.org/installer | php
script:
- php composer.phar install --no-suggest --no-interaction --ignore-platform-reqs --no-progress
cache:
paths:
- vendor
- .composer/cache
artifacts:
paths:
- vendor

analysis:sonarqube-feedback:
stage: analysis
image: ciricihq/gitlab-sonar-scanner
variables:
SONAR_URL: "https://sonar.fdmg.org"
SONAR_PROJECT_VERSION: "$CI_BUILD_ID"
SONAR_ANALYSIS_MODE: "issues"
script:
- /usr/bin/sonar-scanner-run.sh

reporting:sonarqube-report:
stage: reporting
image: ciricihq/gitlab-sonar-scanner
variables:
SONAR_URL: "https://sonar.fdmg.org"
SONAR_PROJECT_VERSION: "$CI_BUILD_ID"
SONAR_ANALYSIS_MODE: "publish"
script:
- unset CI_BUILD_REF && /usr/bin/sonar-scanner-run.sh
dependencies:
- testing:phpunit

analysis:php-cs-fixer:
stage: analysis
image: php:7.1-alpine
script:
- vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --allow-risky=yes --dry-run --using-cache=no --path-mode=intersection `git diff --name-only --diff-filter=ACMRTUXB HEAD~..$CI_BUILD_REF`
dependencies:
- build:composer

analysis:security-checker:
stage: analysis
image: php:7.1-alpine
script:
- vendor/bin/security-checker security:check composer.lock
dependencies:
- build:composer

testing:phpunit:
stage: testing
image: php:7.1-alpine
before_script:
- apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS
- docker-php-source extract
- pecl install xdebug
- docker-php-ext-enable xdebug
- docker-php-source delete
- echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- apk del .phpize-deps
script:
- php vendor/bin/phpunit --coverage-text --colors=never --exclude-group functional --coverage-clover=report/phpunit/clover.xml --log-junit=report/phpunit/junit.xml
dependencies:
- build:composer
artifacts:
paths:
- report/phpunit
197 changes: 197 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
;

return PhpCsFixer\Config::create()
->setFinder($finder)
->setRiskyAllowed(false)
->setRules(
[
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => true,
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_return' => true,
'braces' => true,
'cast_spaces' => true,
'class_definition' => true,
'class_keyword_remove' => false,
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'declare_strict_types' => false, //risky
'dir_constant' => false, // risky
'elseif' => true,
'encoding' => true,
'ereg_to_preg' => false,
'full_opening_tag' => true,
'function_declaration' => true,
'function_typehint_space' => true,
'general_phpdoc_annotation_remove' => false,
'hash_to_slash_comment' => true,
//'header_comment' => ['header' => 'header'],
'heredoc_to_nowdoc' => false,
'include' => true,
//'indentation_type' => [],
'line_ending' => true,
'linebreak_after_opening_tag' => true,
'lowercase_cast' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'mb_str_functions' => false,
'method_argument_space' => true,
'method_separation' => true,
'modernize_types_casting' => false, // risky
'native_function_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => false,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_blank_lines_before_namespace' => false,
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => [
'break',
'continue',
'extra',
'return',
'throw',
'use',
'useTrait',
'curly_brace_block',
'parenthesis_brace_block',
'square_brace_block',
],
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => ['use' => 'echo'],
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_php4_constructor' => false, //risky
'no_short_bool_cast' => true,
'no_short_echo_tag' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => ['outside', 'inside'],
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => false,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => [
'break',
'clone',
'continue',
'echo_print',
'return',
'switch_case',
'yield',
],
'no_unreachable_default_argument_value' => false, // risky
'no_unused_imports' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_space' => false,
'not_operator_with_successor_space' => false,
'object_operator_without_whitespace' => false,
/*
'ordered_class_elements' => [
'use_trait',
'public',
'protected',
'private',
'constant',
'constant_public',
'constant_protected',
'constant_private',
//'property',
'property_static',
'property_public',
'property_protected',
'property_private',
'property_public_static',
'property_protected_static',
'property_private_static',
'construct',
//'method',
'method_static',
'method_public',
'method_protected',
'method_private',
'method_public_static',
'method_protected_static',
'method_private_static',
'destruct',
'magic',
'phpunit',
],
*/
'ordered_imports' => true,
'php_unit_construct' => false, // risky
'php_unit_dedicate_assert' => false, // risky
'php_unit_fqcn_annotation' => true,
'php_unit_strict' => false, // risky
'phpdoc_add_missing_param_annotation' => [],
'phpdoc_align' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => false,
'phpdoc_no_empty_return' => false,
'phpdoc_no_package' => true,
'phpdoc_order' => true, // ?
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => false,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => false, // risky
'pre_increment' => true,
'protected_to_private' => false,
'psr0' => false,// risky
'psr4' => false,// risky
'random_api_migration' => false, // risky
'return_type_declaration' => true,
'self_accessor' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
'silenced_deprecation_error' => false, // risky
'simplified_null_return' => false, // risky
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => ['property', 'const'],
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'strict_comparison' => false, // risky
'strict_param' => false, // risky
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'property',
'method',
//'const'
],
'whitespace_after_comma_in_array' => true,

]
)
;
5 changes: 1 addition & 4 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
build:
environment:
php: '5.6.0'

before_commands:
- "composer install --prefer-source"
php: '7.1'
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: php
php:
- '7.1'

before_script:
- composer self-update
- wget https://scrutinizer-ci.com/ocular.phar

install: composer update --prefer-source $COMPOSER_FLAGS --no-interaction

script:
- ./vendor/bin/phpunit --coverage-clover=build/logs/clover.xml

notifications:
email:
- tech@webservices.nl
slack: webservicesnl:pu5cpnpMCo2HXxPlN29DqHwU

after_script:
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@
},
"type": "library",
"require": {
"php": "^5.4 || ^7.0",
"php": "^5.4 || ^7",
"doctrine/collections": "^1.3",
"psr/http-message": "^1.0",
"psr/log": "^1.0"
"psr/log": "^1.0",
"roave/security-advisories": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "^5",
"mockery/mockery": "^0.9.4",
"league/factory-muffin": "^2.1",
"league/factory-muffin-faker": "~1.0-beta"
"league/factory-muffin-faker": "~1.0-beta",
"sensiolabs/security-checker": "^4",
"friendsofphp/php-cs-fixer": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading