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

composer run for launching code quality #49

Merged
merged 2 commits into from
Apr 19, 2022
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.git
.phpunit.result.cache
.phpunit.result.cache
.php-cs-fixer.cache
8 changes: 7 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?php

$finder = PhpCsFixer\Finder::create();
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src',
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true);
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,21 @@ When using the CDN API V1, you can't resolve relationships of resolved entries a
When using the CDN API V2 you can resolve also nested relationships in the resolved entries (just 2 levels deep), but the resolved entries are not injected in the fields, they are inserted in an array called `rels` which is in the root object. The resolved links will be placed in an array called `links`.
In case you are using the API V2, to keep a consistent behaviour with the API V1, this client will inject the resolved entries and links inside the fields for you.

## Code Quality

The package includes tools for tests and code formatting:
- [PestPHP](https://pestphp.com/)
- [PHP CS Fixer](https://cs.symfony.com/)
To execute the code quality suite you can use:
```shell
composer run all-check
```
that executes:
- vendor/bin/php-cs-fixer fix
- vendor/bin/pest



## 🔗 Related Links

* **[Storyblok & PHP on GitHub](https://github.com/search?q=org%3Astoryblok+topic%3Aphp)**: Check all of our PHP open source repos;
Expand Down
9 changes: 9 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,14 @@
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"scripts": {
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
"all-check": [
"@format",
"@test"
]
}
}