From 30039cec1cdc4f296eb99c6c6fbf25a755bf9a13 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Wed, 8 Sep 2021 12:13:10 +0000 Subject: [PATCH] DevKit updates --- .gitattributes | 5 ++++ .github/workflows/qa.yaml | 62 +++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 5 +++- Makefile | 8 +++++ README.md | 3 ++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/qa.yaml diff --git a/.gitattributes b/.gitattributes index feaef8927..1160f47b7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,3 +8,8 @@ tests export-ignore docs export-ignore Makefile export-ignore phpunit.xml.dist export-ignore +phpstan.neon.dist export-ignore +phpstan-baseline.neon export-ignore +phpstan-console-application.php export-ignore +psalm.xml export-ignore +psalm-baseline.xml export-ignore diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml new file mode 100644 index 000000000..f222d225a --- /dev/null +++ b/.github/workflows/qa.yaml @@ -0,0 +1,62 @@ +# DO NOT EDIT THIS FILE! +# +# It's auto-generated by sonata-project/dev-kit package. + +name: Quality assurance + +on: + push: + branches: + - 4.x + - master + pull_request: + +jobs: + phpstan: + name: PHPStan + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + coverage: none + tools: composer:v2 + + - name: Install Composer dependencies (highest) + uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" + composer-options: "--prefer-dist --prefer-stable" + + - name: PHPStan + run: vendor/bin/phpstan --memory-limit=1G analyse + psalm: + name: Psalm + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + coverage: none + tools: composer:v2 + + - name: Install Composer dependencies (highest) + uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" + composer-options: "--prefer-dist --prefer-stable" + + - name: Psalm + run: vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 061f43a61..78340bf5d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -244,6 +244,9 @@ For instance, assuming you want to introduce a new method to an existing interfa namespace Foo; +/** + * @method void usefulMethod() + */ interface BarInterface { /** @@ -251,7 +254,7 @@ interface BarInterface * * This method does useful stuff. */ - // public function usefulMethod(); + // public function usefulMethod(): void; // … } diff --git a/Makefile b/Makefile index be0173878..bf55c4bcc 100644 --- a/Makefile +++ b/Makefile @@ -87,3 +87,11 @@ coverage: docs: cd docs && sphinx-build -W -b dirhtml -d _build/doctrees . _build/html .PHONY: docs + +phpstan: + vendor/bin/phpstan --memory-limit=1G analyse +.PHONY: phpstan + +psalm: + vendor/bin/psalm +.PHONY: psalm diff --git a/README.md b/README.md index 6db26ea21..f51b968a6 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Symfony SonataUserBundle [![Latest Stable Version](https://poser.pugx.org/sonata-project/user-bundle/v/stable)](https://packagist.org/packages/sonata-project/user-bundle) [![Latest Unstable Version](https://poser.pugx.org/sonata-project/user-bundle/v/unstable)](https://packagist.org/packages/sonata-project/user-bundle) +[![Psalm Type Coverage][shepherd_stable_badge]][shepherd_stable_link] [![License](https://poser.pugx.org/sonata-project/user-bundle/license)](https://packagist.org/packages/sonata-project/user-bundle) [![Total Downloads](https://poser.pugx.org/sonata-project/user-bundle/downloads)](https://packagist.org/packages/sonata-project/user-bundle) @@ -45,6 +46,8 @@ This package is available under the [MIT license](LICENSE). [coverage_stable_link]: https://codecov.io/gh/sonata-project/SonataUserBundle/branch/4.x [coverage_unstable_badge]: https://codecov.io/gh/sonata-project/SonataUserBundle/branch/master/graph/badge.svg [coverage_unstable_link]: https://codecov.io/gh/sonata-project/SonataUserBundle/branch/master +[shepherd_stable_badge]: https://shepherd.dev/github/sonata-project/SonataUserBundle/coverage.svg +[shepherd_stable_link]: https://shepherd.dev/github/sonata-project/SonataUserBundle [documentation_stable_badge]: https://readthedocs.org/projects/sonatauserbundle/badge/?version=4.x [documentation_stable_link]: https://docs.sonata-project.org/projects/SonataUserBundle/en/4.x/?badge=4.x