Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add static analysis #470

Merged
merged 3 commits into from
Dec 29, 2020
Merged
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
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ commands:
key: composer-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "composer.json" }}
paths:
- vendor
run-static-analysis:
steps:
- run: composer static-analysis
run-unit-tests:
steps:
- run: composer test-unit-ci
Expand All @@ -37,6 +40,7 @@ jobs:
- image: circleci/php:7.3
steps:
- prepare
- run-static-analysis
- run-unit-tests
- run:
command: bash <(curl -s https://codecov.io/bash)
Expand All @@ -46,6 +50,7 @@ jobs:
- image: circleci/php:7.4
steps:
- prepare
- run-static-analysis
- run-unit-tests
- run:
command: bash <(curl -s https://codecov.io/bash)
Expand All @@ -55,6 +60,7 @@ jobs:
- image: circleci/php:8.0
steps:
- prepare
- run-static-analysis
- run-unit-tests
- run:
command: bash <(curl -s https://codecov.io/bash)
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ echo '#!/bin/sh' > .git/hooks/pre-commit && echo 'composer pre-commit' >> .git/h
- Run `composer phpcs` for the changed PHP files before submitting your PR for review (optional).
- Keep PRs focused and change the minimum number of lines to achieve your goal.

### Running static analysis

Prior to making a PR, make sure the static analysis suite detects no defects:

`composer static-analysis`

### Running unit tests

Prior to making a PR, ensure that the unit tests pass:
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"cache/adapter-common": "^1.2",
"cache/hierarchical-cache": "^1.1",
"cache/array-adapter": "^1.1"
"cache/array-adapter": "^1.1",
"phpstan/phpstan": "^0.12.64"
},
"autoload": {
"psr-4": {
Expand All @@ -51,12 +52,14 @@
"test-unit-ci": "SHELL_INTERACTIVE=1 \"vendor/bin/phpunit\" --stop-on-failure --coverage-clover=build/coverage.xml --testsuite=unit",
"test-integration": "SHELL_INTERACTIVE=1 \"vendor/bin/phpunit\" --coverage-text --testsuite=integration",
"test-integration-ci": "\"vendor/bin/phpunit\" --stop-on-failure --coverage-clover=build/coverage.xml --testsuite=integration",
"static-analysis": "@php ./vendor/bin/phpstan analyze",
"compat": "@php ./vendor/bin/phpcs --standard=.phpcs-compat.xml.dist",
"format": "@php ./vendor/bin/phpcbf",
"lint": "@php ./vendor/bin/phpcs",
"sniffs": "\"vendor/bin/phpcs\" -e",
"config-phpcs": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
"pre-commit": [
"@static-analysis",
"@test",
"@format",
"@compat"
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
checkGenericClassInNonGenericObjectType: false
level: 1
paths:
- src