diff --git a/.bettercodehub.yml b/.bettercodehub.yml new file mode 100644 index 0000000..79487db --- /dev/null +++ b/.bettercodehub.yml @@ -0,0 +1,3 @@ +component_depth: 1 +languages: + - php diff --git a/.circleci/config.yml b/.circleci/config.yml index 155f5ac..3fa44fb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,7 +16,7 @@ jobs: key: composer-v1-{{ checksum "composer.json" }} paths: - vendor - - run: vendor/bin/phpunit --colors --columns 121 --coverage-text + - run: vendor/bin/phpunit -c phpunit.xml --colors --columns 117 --coverage-clover=clover.xml --coverage-text phpcs: docker: - image: circleci/php:7.1 @@ -67,7 +67,7 @@ jobs: key: composer-v1-{{ checksum "composer.json" }} paths: - vendor - - run: vendor/bin/phpstan analyse -l 7 -c phpstan.neon --autoload-file=vendor/autoload.php --memory-limit=768M --no-progress src tests + - run: vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=768M --no-progress workflows: version: 2 diff --git a/.codacy.yml b/.codacy.yml new file mode 100644 index 0000000..09eb642 --- /dev/null +++ b/.codacy.yml @@ -0,0 +1,6 @@ +--- +engines: + phpcs: + enabled: true + phpmd: + enabled: false diff --git a/.codeclimate.yml b/.codeclimate.yml index 81c1061..41ce484 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,57 +1,53 @@ ---- -engines: - duplication: - enabled: true +version: "2" +checks: + argument-count: + config: + threshold: 4 + complex-logic: + config: + threshold: 4 + file-lines: + config: + threshold: 250 + method-complexity: + config: + threshold: 5 + method-count: + config: + threshold: 20 + method-lines: + enabled: false + config: + threshold: 25 + nested-control-flow: + config: + threshold: 4 + return-statements: + enabled: false config: - languages: - php: - mass_threshold: 40 - checks: - Similar Code: - enabled: false - Identical code: - enabled: false - Similar code: - enabled: false + threshold: 4 + similar-code: + enabled: false + config: + threshold: # language-specific defaults. an override will affect all languages. + identical-code: + enabled: false + config: + threshold: # language-specific defaults. an override will affect all languages. + +plugins: fixme: enabled: true phpmd: - enabled: true - config: - file_extensions: "php" - rulesets: "unusedcode,codesize,naming,cleancode" - checks: - Naming/ShortVariable: - enabled: false - Design/CouplingBetweenObjects: - enabled: false - Design/WeightedMethodCount: - enabled: false - Design/LongClass: - enabled: false - Design/LongMethod: - enabled: false - Design/NpathComplexity: - enabled: false - CyclomaticComplexity: - enabled: false - CleanCode/ElseExpression: - enabled: false - CleanCode/StaticAccess: - enabled: false + enabled: false phan: enabled: false - config: - file_extensions: "php" phpcodesniffer: enabled: true config: file_extensions: "php" standard: "PSR2" ignore_warnings: true -ratings: - paths: - - "**.php" -exclude_paths: -- tests/* -- vendor/* +exclude_patterns: + - "tests/" + - "vendor/" diff --git a/.gitattributes b/.gitattributes index ecbc20e..978cdeb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -23,6 +23,8 @@ LICENSE text eol=lf # files/folders to ignore /.* export-ignore +.bettercodehub.yml export-ignore text eol=lf +.codacy.yml export-ignore text eol=lf .codeclimate.yml export-ignore text eol=lf .coveralls.yml export-ignore text eol=lf .editorconfig export-ignore text eol=lf @@ -36,6 +38,7 @@ LICENSE text eol=lf appveyor.yml export-ignore text eol=lf .circleci/config.yml export-ignore text eol=lf codecov.yml export-ignore text eol=lf +infection.json export-ignore text eol=lf phpcs.xml export-ignore text eol=lf phpstan.neon export-ignore text eol=lf phpunit.xml export-ignore text eol=lf diff --git a/.php_cs b/.php_cs index 36fa585..8e57140 100644 --- a/.php_cs +++ b/.php_cs @@ -2,7 +2,7 @@ /** * This file is part of the json-cache package. * - * Copyright (c) 2018, Thomas Mueller + * Copyright (c) 2018-2019, Thomas Mueller * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,7 +13,7 @@ declare(strict_types = 1); $header = <<<'EOF' This file is part of the json-cache package. -Copyright (c) 2018, Thomas Mueller +Copyright (c) 2018-2019, Thomas Mueller For the full copyright and license information, please view the LICENSE file that was distributed with this source code. diff --git a/.travis.yml b/.travis.yml index ae934a2..7ca0fc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,9 @@ php: - 7.2 - 7.3 -os: linux +os: + - linux + #- windows env: - COMPOSER_FLAGS="--prefer-lowest" @@ -17,10 +19,6 @@ cache: directories: - $HOME/.composer/cache -addons: - code_climate: - repo_token: 43db4d76514521ffd97e65f2a6806a106ae168f1db55397741485212f9c70ae7 - stages: - composer validate - static code analysis @@ -32,7 +30,9 @@ before_install: - phpenv config-rm xdebug.ini || echo "xdebug not available" - echo 'opcache.enable=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - echo 'opcache.enable_cli=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - travis_retry composer self-update + - echo 'zend.assertions=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - echo 'assert.exception=On' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - composer self-update install: travis_retry composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest $COMPOSER_FLAGS -vv @@ -42,11 +42,13 @@ jobs: allow_failures: - php: 7.3 - php: nightly + #- os: windows include: - php: nightly env: COMPOSER_FLAGS="--ignore-platform-reqs" - stage: test with coverage + os: linux php: 7.1 env: - COVERAGE=yes @@ -55,13 +57,16 @@ jobs: - stty cols 130 - echo 'opcache.enable=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - echo 'opcache.enable_cli=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - travis_retry composer self-update + - echo 'zend.assertions=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - echo 'assert.exception=On' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - composer self-update script: vendor/bin/phpunit -c phpunit.xml --colors --columns 117 --coverage-clover=clover.xml --coverage-text after_success: - - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.0.0/php-coveralls.phar && php -n php-coveralls.phar --verbose --coverage_clover=clover.xml + - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar && php -n php-coveralls.phar --verbose --coverage_clover=clover.xml - bash <(curl -s https://codecov.io/bash) -f clover.xml -F phpunit - stage: composer validate + os: linux php: 7.1 env: COMPOSER_FLAGS="" script: @@ -69,6 +74,7 @@ jobs: - composer normalize --dry-run - stage: static code analysis + os: linux php: 7.1 env: - TEST=phpcs @@ -76,6 +82,7 @@ jobs: script: vendor/bin/phpcs --colors - stage: static code analysis + os: linux php: 7.1 env: - TEST=php-cs-fixer @@ -83,11 +90,12 @@ jobs: script: vendor/bin/php-cs-fixer fix --dry-run -vv - stage: static code analysis + os: linux php: 7.1 env: - TEST=phpstan - COMPOSER_FLAGS="" - script: vendor/bin/phpstan analyse -l max -c phpstan.neon --autoload-file=vendor/autoload.php --memory-limit=768M --no-progress src tests + script: vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=768M --no-progress notifications: email: false diff --git a/LICENSE b/LICENSE index 5c7d1d4..21c2481 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Thomas Müller +Copyright (c) 2018-2019 Thomas Müller Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/composer.json b/composer.json index 198bece..d6a5d15 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require": { "php": "^7.1", "ext-json": "*", - "daverandom/exceptional-json": "^1.0.1" + "daverandom/exceptional-json": "^1.0.4" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.13", @@ -32,8 +32,8 @@ "phpstan/phpstan-deprecation-rules": "^0.10", "phpstan/phpstan-phpunit": "^0.10", "phpstan/phpstan-strict-rules": "^0.10", - "phpunit/phpunit": "^7.4", - "squizlabs/php_codesniffer": "^3.3" + "phpunit/phpunit": "^7.5", + "squizlabs/php_codesniffer": "^3.4" }, "autoload": { "psr-4": { diff --git a/phpstan.neon b/phpstan.neon index 533db5f..9c8b41e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,10 @@ parameters: + level: max + paths: + - src + - tests autoload_files: + - %currentWorkingDirectory%/vendor/autoload.php - %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/autoload.php - %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/src/Util/Tokens.php includes: diff --git a/src/Json.php b/src/Json.php index 0798b16..e098ab5 100644 --- a/src/Json.php +++ b/src/Json.php @@ -2,7 +2,7 @@ /** * This file is part of the json-cache package. * - * Copyright (c) 2018, Thomas Mueller + * Copyright (c) 2018-2019, Thomas Mueller * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/JsonInterface.php b/src/JsonInterface.php index 130c494..4e0c14b 100644 --- a/src/JsonInterface.php +++ b/src/JsonInterface.php @@ -2,7 +2,7 @@ /** * This file is part of the json-cache package. * - * Copyright (c) 2018, Thomas Mueller + * Copyright (c) 2018-2019, Thomas Mueller * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/JsonTest.php b/tests/JsonTest.php index 954ac04..02b0863 100644 --- a/tests/JsonTest.php +++ b/tests/JsonTest.php @@ -2,7 +2,7 @@ /** * This file is part of the json-cache package. * - * Copyright (c) 2018, Thomas Mueller + * Copyright (c) 2018-2019, Thomas Mueller * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code.