From cb6a9b81412463a2cacdeec704a6811a72001cbb Mon Sep 17 00:00:00 2001 From: Rodolfo Berrios <20590102+rodber@users.noreply.github.com> Date: Sat, 2 Dec 2023 09:17:13 -0300 Subject: [PATCH] Initial commit --- .ecs/.header | 6 + .ecs/ecs-chevere.php | 123 +++++++++++++++++++ .ecs/ecs.php | 21 ++++ .gitattributes | 13 ++ .github/workflows/sonarcloud.yml | 53 ++++++++ .github/workflows/test.yml | 49 ++++++++ .gitignore | 7 ++ .vscode/coverage.code-snippets | 30 +++++ .vscode/docblock.code-snippets | 50 ++++++++ .vscode/settings.json | 12 ++ .vscode/templates.code-snippets | 143 ++++++++++++++++++++++ .vscode/test.code-snippets | 72 +++++++++++ LICENSE | 202 +++++++++++++++++++++++++++++++ README.md | 31 +++++ chevere.svg | 14 +++ composer.json | 77 ++++++++++++ infection.json.dist | 18 +++ phpunit-coverage.xml | 33 +++++ phpunit.xml | 25 ++++ sonar-project.properties | 8 ++ src/.git-keep | 0 tests/.git-keep | 0 22 files changed, 987 insertions(+) create mode 100644 .ecs/.header create mode 100644 .ecs/ecs-chevere.php create mode 100644 .ecs/ecs.php create mode 100644 .gitattributes create mode 100644 .github/workflows/sonarcloud.yml create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 .vscode/coverage.code-snippets create mode 100644 .vscode/docblock.code-snippets create mode 100644 .vscode/settings.json create mode 100644 .vscode/templates.code-snippets create mode 100644 .vscode/test.code-snippets create mode 100644 LICENSE create mode 100644 README.md create mode 100644 chevere.svg create mode 100644 composer.json create mode 100644 infection.json.dist create mode 100644 phpunit-coverage.xml create mode 100644 phpunit.xml create mode 100644 sonar-project.properties create mode 100644 src/.git-keep create mode 100644 tests/.git-keep diff --git a/.ecs/.header b/.ecs/.header new file mode 100644 index 0000000..574d2da --- /dev/null +++ b/.ecs/.header @@ -0,0 +1,6 @@ +This file is part of Chevere. + +(c) Rodolfo Berrios + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. \ No newline at end of file diff --git a/.ecs/ecs-chevere.php b/.ecs/ecs-chevere.php new file mode 100644 index 0000000..fe1e14a --- /dev/null +++ b/.ecs/ecs-chevere.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +use PhpCsFixer\Fixer\Alias\NoAliasFunctionsFixer; +use PhpCsFixer\Fixer\Alias\NoAliasLanguageConstructCallFixer; +use PhpCsFixer\Fixer\Alias\NoMixedEchoPrintFixer; +use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; +use PhpCsFixer\Fixer\ArrayNotation\NoMultilineWhitespaceAroundDoubleArrowFixer; +use PhpCsFixer\Fixer\ArrayNotation\NormalizeIndexBraceFixer; +use PhpCsFixer\Fixer\Casing\IntegerLiteralCaseFixer; +use PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer; +use PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer; +use PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer; +use PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer; +use PhpCsFixer\Fixer\Casing\NativeFunctionTypeDeclarationCasingFixer; +use PhpCsFixer\Fixer\CastNotation\NoShortBoolCastFixer; +use PhpCsFixer\Fixer\CastNotation\NoUnsetCastFixer; +use PhpCsFixer\Fixer\Comment\HeaderCommentFixer; +use PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer; +use PhpCsFixer\Fixer\ControlStructure\IncludeFixer; +use PhpCsFixer\Fixer\ControlStructure\NoAlternativeSyntaxFixer; +use PhpCsFixer\Fixer\FunctionNotation\LambdaNotUsedImportFixer; +use PhpCsFixer\Fixer\Import\OrderedImportsFixer; +use PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer; +use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer; +use PhpCsFixer\Fixer\LanguageConstruct\SingleSpaceAroundConstructFixer; +use PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer; +use PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer; +use PhpCsFixer\Fixer\Operator\NoSpaceAroundDoubleColonFixer; +use PhpCsFixer\Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer; +use PhpCsFixer\Fixer\Operator\StandardizeNotEqualsFixer; +use PhpCsFixer\Fixer\PhpTag\LinebreakAfterOpeningTagFixer; +use PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer; +use PhpCsFixer\Fixer\ReturnNotation\ReturnAssignmentFixer; +use PhpCsFixer\Fixer\Semicolon\MultilineWhitespaceBeforeSemicolonsFixer; +use PhpCsFixer\Fixer\Semicolon\NoEmptyStatementFixer; +use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer; +use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer; +use PhpCsFixer\Fixer\Whitespace\BlankLineBeforeStatementFixer; +use PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer; +use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer; +use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer; +use Symplify\CodingStandard\Fixer\Commenting\ParamReturnAndVarTagMalformsFixer; +use Symplify\EasyCodingStandard\Config\ECSConfig; +use Symplify\EasyCodingStandard\ValueObject\Set\SetList; + +return static function (ECSConfig $ecsConfig): void { + $ecsConfig->parallel(); + $headerFile = __DIR__ . '/.header'; + $ecsConfig->sets([SetList::PSR_12, SetList::COMMON]); + if (file_exists($headerFile)) { + $ecsConfig->ruleWithConfiguration(HeaderCommentFixer::class, [ + 'header' => file_get_contents($headerFile), + 'location' => 'after_open', + ]); + } + $ecsConfig->rule(TypesSpacesFixer::class); + $ecsConfig->rule(NoUselessReturnFixer::class); + $ecsConfig->rule(LinebreakAfterOpeningTagFixer::class); + $ecsConfig->rule(StandardizeNotEqualsFixer::class); + $ecsConfig->rule(NoSpaceAroundDoubleColonFixer::class); + $ecsConfig->rule(CleanNamespaceFixer::class); + $ecsConfig->rule(ListSyntaxFixer::class); + $ecsConfig->rule(SingleSpaceAroundConstructFixer::class); + $ecsConfig->rule(LambdaNotUsedImportFixer::class); + $ecsConfig->rule(NoAlternativeSyntaxFixer::class); + $ecsConfig->rule(NoUnsetCastFixer::class); + $ecsConfig->rule(NoShortBoolCastFixer::class); + $ecsConfig->rule(NativeFunctionTypeDeclarationCasingFixer::class); + $ecsConfig->rule(NativeFunctionCasingFixer::class); + $ecsConfig->rule(MagicMethodCasingFixer::class); + $ecsConfig->rule(MagicConstantCasingFixer::class); + $ecsConfig->rule(LowercaseStaticReferenceFixer::class); + $ecsConfig->rule(IntegerLiteralCaseFixer::class); + $ecsConfig->rule(NormalizeIndexBraceFixer::class); + $ecsConfig->rule(NoMultilineWhitespaceAroundDoubleArrowFixer::class); + $ecsConfig->rule(BlankLineBeforeStatementFixer::class); + $ecsConfig->rule(CombineConsecutiveUnsetsFixer::class); + $ecsConfig->rule(CompactNullableTypehintFixer::class); + $ecsConfig->rule(DeclareStrictTypesFixer::class); + $ecsConfig->rule(IncludeFixer::class); + $ecsConfig->rule(MultilineWhitespaceBeforeSemicolonsFixer::class); + $ecsConfig->rule(NoAliasFunctionsFixer::class); + $ecsConfig->rule(NoAliasLanguageConstructCallFixer::class); + $ecsConfig->rule(NoEmptyStatementFixer::class); + $ecsConfig->rule(NoMixedEchoPrintFixer::class); + $ecsConfig->rule(ObjectOperatorWithoutWhitespaceFixer::class); + $ecsConfig->rule(ParamReturnAndVarTagMalformsFixer::class); + $ecsConfig->rule(ReturnAssignmentFixer::class); + $ecsConfig->ruleWithConfiguration(SingleLineCommentStyleFixer::class, [ + 'comment_types' => ['hash'], + ]); + $ecsConfig->rule(SingleQuoteFixer::class); + $ecsConfig->ruleWithConfiguration(OrderedImportsFixer::class, [ + 'imports_order' => ['class', 'function', 'const'], + ]); + $ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [ + 'syntax' => 'short', + ]); + $ecsConfig->ruleWithConfiguration(NoExtraBlankLinesFixer::class, [ + 'tokens' => [ + 'curly_brace_block', + 'extra', + 'parenthesis_brace_block', + 'square_brace_block', + 'throw', + 'use', + ], + ]); + $ecsConfig->skip([ + SingleImportPerStatementFixer::class => null, + ]); +}; diff --git a/.ecs/ecs.php b/.ecs/ecs.php new file mode 100644 index 0000000..8d0f7a0 --- /dev/null +++ b/.ecs/ecs.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +use Symplify\EasyCodingStandard\Config\ECSConfig; + +return static function (ECSConfig $ecsConfig): void { + $ecsConfig->import(__DIR__ . '/ecs-chevere.php'); + $ecsConfig->skip([ + __DIR__ . '/vendor/*', + ]); +}; diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7574093 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +/.ecs export-ignore +/.github export-ignore +/.vscode export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/phpunit-coverage.xml export-ignore +/phpunit.xml export-ignore +/rector.php export-ignore +/sonar-project.properties export-ignore +/infection.json.dist export-ignore + +*.php diff=php diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000..4c7b1f3 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,53 @@ +name: SonarCloud +on: [push] +jobs: + sonarcloud: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + php: ["8.2"] + env: + tools: composer + ini-values: default_charset='UTF-8' + key: cache-1690242875644 + name: PHP ${{ matrix.php }} test on ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: ${{ env.ini-values }} + coverage: pcov + tools: ${{ env.tools }} + env: + fail-fast: true + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Validate composer + run: composer validate + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies + run: composer install --no-progress + - name: Tests (PHPUnit) + run: vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --log-junit=build/logs/junit.xml + - name: Fix paths for sonar-scanner + working-directory: ./build/logs + run: | + sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace@g' clover.xml + sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace@g' junit.xml + - name: SonarCloud scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7975a7f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,49 @@ +name: Test +on: [push] +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + php: ["8.1", "8.2", "8.3"] + env: + tools: composer, phpstan, infection + ini-values: default_charset='UTF-8' + key: cache-1690242875644 + name: PHP ${{ matrix.php }} test on ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: ${{ env.ini-values }} + coverage: pcov + tools: ${{ env.tools }} + env: + fail-fast: true + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Validate composer + run: composer validate + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies + run: composer install --no-progress + - name: Run PHPStan + run: composer phpstan + - name: Tests (PHPUnit) + run: vendor/bin/phpunit --coverage-xml=build/logs/xml-coverage --log-junit=build/logs/junit.xml + - name: Mutation testing (Infection) + env: + INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} + run: infection --coverage=build/logs --min-covered-msi=90 --threads=$(nproc) --logger-github --only-covered diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eda9b7d --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +/.idea +/.phpunit.cache +/.scannerwork +/vendor +/composer.lock +/build diff --git a/.vscode/coverage.code-snippets b/.vscode/coverage.code-snippets new file mode 100644 index 0000000..b4968c3 --- /dev/null +++ b/.vscode/coverage.code-snippets @@ -0,0 +1,30 @@ +{ + "coverage-ignore": { + "description": "Code coverage ignore tag", + "prefix": "cov-ignore", + "body": [ + "@codeCoverageIgnore" + ] + }, + "coverage-ignore-start": { + "description": "Code coverage ignore start tag", + "prefix": "cov-ignore-start", + "body": [ + "@codeCoverageIgnoreStart" + ] + }, + "coverage-ignore-end": { + "description": "Code coverage ignore end tag", + "prefix": "cov-ignore-end", + "body": [ + "@codeCoverageIgnoreEnd" + ] + }, + "coverage-infection-ignore-all": { + "description": "Comment infection ignore all", + "prefix": "comment-infection-ignore-all", + "body": [ + "@infection-ignore-all.", + ] + }, +} \ No newline at end of file diff --git a/.vscode/docblock.code-snippets b/.vscode/docblock.code-snippets new file mode 100644 index 0000000..a790d7b --- /dev/null +++ b/.vscode/docblock.code-snippets @@ -0,0 +1,50 @@ +{ + "docblock-construct": { + "description": "Docblock construct", + "prefix": "docblock-construct", + "body": [ + "/**", + " * Does?", + " */" + ] + }, + "docblock-instance": { + "description": "Docblock instance", + "prefix": "docblock-instance", + "body": [ + "/**", + " * Provides access to the ${1:name} instance.", + " */" + ] + }, + "docblock-immutable": { + "description": "Docblock immutable", + "prefix": "docblock-immutable", + "body": [ + "/**", + " * Return an instance with the specified ${1:name}.", + " *", + " * This method MUST retain the state of the current instance, and return", + " * an instance that contains the specified ${1:name}.", + " */" + ] + }, + "docblock-boolean": { + "description": "Docblock boolean", + "prefix": "docblock-boolean", + "body": [ + "/**", + " * Indicates whether the instance has ${1:name}.", + " */" + ] + }, + "docblock-interface": { + "description": "Docblock interface", + "prefix": "docblock-interface", + "body": [ + "/**", + " * Describes the component in charge of ${1:doing}.", + " */" + ] + } +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5a32600 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,12 @@ +{ + "runOnSave.commands": [ + { + "match": "\\.php$", + "runIn": "backend", + "command": "cd ${workspaceFolder} && vendor/bin/ecs --config='.ecs/ecs.php' check ${file} --fix", + "workingDirectoryAsCWD": true, + "runningStatusMessage": "ECS ${fileBasename}", + "finishStatusMessage": "${fileBasename} OK" + }, + ] +} \ No newline at end of file diff --git a/.vscode/templates.code-snippets b/.vscode/templates.code-snippets new file mode 100644 index 0000000..b9607d8 --- /dev/null +++ b/.vscode/templates.code-snippets @@ -0,0 +1,143 @@ +{ + "top-level-interface": { + "description": "Top-level Interface", + "prefix": "interface-tl", + "body": [ + "${3:argument} = \\$${3:argument};", + "", + "\treturn \\$new;", + "}" + ] + }, +} diff --git a/.vscode/test.code-snippets b/.vscode/test.code-snippets new file mode 100644 index 0000000..721d452 --- /dev/null +++ b/.vscode/test.code-snippets @@ -0,0 +1,72 @@ +{ + "top-level-test": { + "description": "Top-level Test", + "prefix": "test-tl", + "body": [ + " 🔔 Subscribe to the [newsletter](https://chv.to/chevere-newsletter) to don't miss any update regarding Chevere. + +![Chevere](chevere.svg) + +[![Build](https://img.shields.io/github/actions/workflow/status/chevere/reponame/test.yml?branch=%branch%&style=flat-square)](https://github.com/chevere/reponame/actions) +![Code size](https://img.shields.io/github/languages/code-size/chevere/reponame?style=flat-square) +[![Apache-2.0](https://img.shields.io/github/license/chevere/reponame?style=flat-square)](LICENSE) +[![PHPStan](https://img.shields.io/badge/PHPStan-level%209-blueviolet?style=flat-square)](https://phpstan.org/) +[![Mutation testing badge](https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fchevere%2Freponame%2F%branch%)](https://dashboard.stryker-mutator.io/reports/github.com/chevere/reponame/%branch%) + +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=chevere_reponame&metric=alert_status)](https://sonarcloud.io/dashboard?id=chevere_reponame) +[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_reponame&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=chevere_reponame) +[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_reponame&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=chevere_reponame) +[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_reponame&metric=security_rating)](https://sonarcloud.io/dashboard?id=chevere_reponame) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=chevere_reponame&metric=coverage)](https://sonarcloud.io/dashboard?id=chevere_reponame) +[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=chevere_reponame&metric=sqale_index)](https://sonarcloud.io/dashboard?id=chevere_reponame) +[![CodeFactor](https://www.codefactor.io/repository/github/chevere/reponame/badge)](https://www.codefactor.io/repository/github/chevere/reponame) + +## Documentation + +Documentation is available at [chevere.org](https://chevere.org/). + +## License + +Copyright 2023 [Rodolfo Berrios A.](https://rodolfoberrios.com/) + +Chevere is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full license text. + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/chevere.svg b/chevere.svg new file mode 100644 index 0000000..a17dde8 --- /dev/null +++ b/chevere.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..492f9a9 --- /dev/null +++ b/composer.json @@ -0,0 +1,77 @@ +{ + "name": "chevere/reponame", + "description": "A chevere reponame package", + "homepage": "https://chevere.org", + "type": "library", + "license": "Apache-2.0", + "authors": [ + { + "name": "Rodolfo Berrios", + "email": "rodolfo@chevere.org", + "homepage": "https://chevere.org" + } + ], + "require": { + "chevere/chevere": "^3.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.5", + "symplify/easy-coding-standard": "^11.1" + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Chevere\\%namespace%\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Chevere\\Tests\\": "tests/" + } + }, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "scripts": { + "all": [ + "composer phpstan", + "composer test", + "composer test-coverage", + "composer infection -- --skip-initial-tests --coverage=build/logs" + ], + "infection": [ + "Composer\\Config::disableProcessTimeout", + "infection --only-covered -j10" + ], + "infection-filter": "sh -c 'sh -c \"composer infection -- --filter=$0 --test-framework-options=--filter=$0\"' $1", + "phpstan": "vendor/bin/phpstan analyze src/ --memory-limit 512M --level 9", + "test": [ + "Composer\\Config::disableProcessTimeout", + "vendor/bin/phpunit -c phpunit.xml" + ], + "test-coverage": [ + "Composer\\Config::disableProcessTimeout", + "vendor/bin/phpunit -c phpunit-coverage.xml" + ], + "cs-update": "mkdir -p .ecs && cd .ecs && curl -O https://raw.githubusercontent.com/chevere/code-style/main/.ecs/ecs-chevere.php", + "cs-fix": "vendor/bin/ecs --config='.ecs/ecs.php' check src --fix", + "open-coverage": "open build/logs/html/index.html", + "open-infection": "open build/logs/html/infection.html" + }, + "scripts-descriptions": { + "all": "Runs all checks", + "infection": "Runs infection", + "infection-filter": "Runs infection (filtered)", + "phpstan": "Runs phpstan", + "test": "Run test suite", + "test-coverage": "Run test suite (coverage)", + "cs-update": "Update Chevere code style definition", + "cs-fix": "Update Chevere code style definition", + "open-coverage": "Open code coverage report", + "open-infection": "Open infection report" + } +} diff --git a/infection.json.dist b/infection.json.dist new file mode 100644 index 0000000..54e3c58 --- /dev/null +++ b/infection.json.dist @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/infection/infection/0.27.0/resources/schema.json", + "source": { + "directories": [ + "src/" + ] + }, + "logs": { + "html": "build/logs/html/infection.html", + "stryker": { + "report": "/^.*$/" + } + }, + "mutators": { + "@default": true + }, + "testFrameworkOptions": "--configuration=phpunit-coverage.xml" +} diff --git a/phpunit-coverage.xml b/phpunit-coverage.xml new file mode 100644 index 0000000..fa81351 --- /dev/null +++ b/phpunit-coverage.xml @@ -0,0 +1,33 @@ + + + + + tests/ + + + + + + + + src/ + + + src/**/Exceptions/ + + + + + + + + \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..1ab2289 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,25 @@ + + + + + tests/ + + + + + src/ + + + src/**/Exceptions/ + + + \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..4c6eae7 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.projectKey=chevere_reponame +sonar.organization=chevere +sonar.host.url=https://sonarcloud.io +sonar.sourceEncoding=UTF-8 +sonar.sources=src +sonar.tests=tests +sonar.php.tests.reportPath=build/logs/junit.xml +sonar.php.coverage.reportPaths=build/logs/clover.xml diff --git a/src/.git-keep b/src/.git-keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/.git-keep b/tests/.git-keep new file mode 100644 index 0000000..e69de29