diff --git a/.gitignore b/.gitignore index 4e7599cf..a9b9b41b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ phpunit.xml composer.lock humbuglog.txt coverage +phpcs.xml diff --git a/.scrutinizer.yml b/.scrutinizer.yml index cf3d404a..212efdf4 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -5,27 +5,15 @@ build: redis: false rabbitmq: false php: - version: 7.1.0 -tools: - php_sim: true - php_pdepend: true - php_analyzer: true - php_changetracking: true - sensiolabs_security_checker: true - php_mess_detector: true - php_code_coverage: true - external_code_coverage: - timeout: 1800 - php_code_sniffer: - enabled: true - config: - standard: "PSR2" - php_cpd: - enabled: true - excluded_dirs: ["test", "vendor"] - php_loc: - enabled: true - excluded_dirs: ["test", "vendor"] + version: 7.1 + cache: + disabled: false + directories: + - ~/.composer/cache + tests: + after: + - phpcs-run + checks: php: code_rating: true @@ -61,6 +49,78 @@ checks: verify_access_scope_valid: true verify_argument_usable_as_reference: true verify_property_names: true -filter: - excluded_paths: - - test/* + uppercase_constants: true + simplify_boolean_return: true + return_doc_comments: true + remove_extra_empty_lines: true + properties_in_camelcaps: true + phpunit_assertions: true + parameters_in_camelcaps: true + parameter_doc_comments: true + overriding_parameter: true + optional_parameters_at_the_end: true + no_short_variable_names: + minimum: '2' + no_long_variable_names: + maximum: '20' + no_goto: true + newline_at_end_of_file: true + more_specific_types_in_doc_comments: false + function_in_camel_caps: true + encourage_single_quotes: true + encourage_postdec_operator: true + classes_in_camel_caps: true + check_method_contracts: + verify_interface_like_constraints: true + verify_documented_constraints: true + verify_parent_constraints: true + avoid_unnecessary_concatenation: true + avoid_perl_style_comments: true + avoid_multiple_statements_on_same_line: true + align_assignments: true + deadlock_detection_in_loops: true + use_self_instead_of_fqcn: true + single_namespace_per_use: true + side_effects_or_types: true + require_scope_for_properties: true + require_scope_for_methods: true + psr2_switch_declaration: true + psr2_class_declaration: true + property_assignments: true + parse_doc_comments: true + overriding_private_members: true + no_underscore_prefix_in_properties: true + no_underscore_prefix_in_methods: true + no_trait_type_hints: true + no_trailing_whitespace: true + no_short_open_tag: true + no_global_keyword: true + no_exit: true + no_eval: true + no_error_suppression: true + no_empty_statements: true + no_debug_code: true + no_commented_out_code: true + no_unnecessary_if: true + return_in_constructor: true + php5_style_constructor: true + instanceof_class_exists: true + foreach_traversable: true + call_to_parent_method: true + blank_line_after_namespace_declaration: true + avoid_usage_of_logical_operators: true + avoid_superglobals: true + avoid_length_functions_in_loops: true + avoid_duplicate_types: true + avoid_closing_tag: true + avoid_corrupting_byteorder_marks: true + avoid_aliased_php_functions: true + encourage_shallow_comparison: true + +build_failure_conditions: + - 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed + - 'issues.label("coding-style").new.exists' # No new coding style issues allowed + - 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity + - 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection + - 'patches.label("Doc Comments").new.exists' # No new doc comments patches allowed + - 'patches.label("Unused Use Statements").new.exists' # No new unused imports patches allowed diff --git a/.travis.yml b/.travis.yml index 04b4662d..087e6b77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,45 @@ -language: php +dist: trusty sudo: false +language: php php: - 7.1 + - 7.2 - nightly cache: directories: - $HOME/.composer/cache -before_script: - - composer install +before_install: + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" + - composer self-update + +install: travis_retry composer install script: - - ./vendor/bin/phpunit --coverage-clover ./clover.xml --testsuite=unit - - ./vendor/bin/phpunit test/functional -# - if php -i |grep -qE xdebug; then ./vendor/bin/humbug --options='--testsuite=unit'; fi + - ./vendor/bin/phpunit --testsuite=unit + - ./vendor/bin/phpunit --testsuite=functional + +jobs: + allow_failures: + - php: 7.2 + - php: nightly + + include: + - stage: Coverage + before_script: + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,} + - if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi + script: + - ./vendor/bin/phpunit --testsuite=unit --coverage-clover ./clover.xml + after_script: + - wget https://scrutinizer-ci.com/ocular.phar + - php ocular.phar code-coverage:upload --format=php-clover ./clover.xml -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - if [ -f clover.xml ]; then php ocular.phar code-coverage:upload --format=php-clover ./clover.xml; fi +# - stage: Mutation +# before_script: +# - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,} +# - if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi +# script: +# - ./vendor/bin/humbug --options='--testsuite=unit' diff --git a/composer.json b/composer.json index 3ff57f46..21029928 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "phpmd/phpmd": "^2.5", "phpunit/php-invoker": "^1.1", "phpunit/phpunit": "^6.0", - "squizlabs/php_codesniffer": "^2.7" + "squizlabs/php_codesniffer": "^3.0" }, "suggest":{ "mdanter/ecc": "Required to use Elliptic Curves based algorithms." diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000..6da6fa79 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,15 @@ + + + The coding standard for lcobucci/jwt. + + + + + + + + src + test + + +