Skip to content

Commit fd87296

Browse files
authored
Harmonize CI & files (#35)
1 parent 7dcd6e3 commit fd87296

File tree

8 files changed

+79
-51
lines changed

8 files changed

+79
-51
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ vendor
22
build
33
#A library must not provide a composer.lock file
44
composer.lock
5+
6+
# Demo app excluded dirs
7+
features/demo_app/var/
8+
59
#Phpunit
610
.phpunit.result.cache

.remarkrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"plugins": [
33
"remark-preset-lint-consistent",
4-
"remark-preset-lint-recommended"
4+
"remark-preset-lint-recommended",
5+
[
6+
"remark-lint-list-item-indent",
7+
"space"
8+
]
59
]
610
}

.scrutinizer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ build:
4141
variables:
4242
CI: 'true'
4343
TEST_OUTPUT_STYLE: 'pretty'
44-
COMPOSER_OPTIONS: '--optimize-autoloader'
4544
COVERAGE_OUTPUT_STYLE: 'clover'
4645
COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml'
4746
PHPCS_DISABLE_WARNING: 'true'

CODE_OF_CONDUCT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ include:
2323
Examples of unacceptable behavior by participants include:
2424

2525
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
26+
advances
2727
* Trolling, insulting/derogatory comments, and personal or political attacks
2828
* Public or private harassment
2929
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
30+
address, without explicit permission
3131
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
32+
professional setting
3333

3434
## Our Responsibilities
3535

CONTRIBUTING.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
# Contributing
22

33
## Getting Started
4-
* Fork, then clone the repo:
4+
5+
* Fork, then clone the repo:
6+
57
```bash
68
git clone git@github.com:your-username/php-jsonrpc-params-symfony-validator-sdk.git
7-
````
9+
```
10+
11+
* Make sure everything goes well:
812

9-
* Make sure everything goes well:
1013
```bash
1114
make build
1215
make test
1316
```
1417

15-
* Make your changes (Add/Update tests according to your changes).
16-
* Make sure tests are still green:
18+
* Make your changes (Add/Update tests according to your changes).
19+
* Make sure tests are still green:
20+
1721
```bash
1822
make test
1923
```
2024

21-
* To check code coverage, launch
25+
* To check code coverage, launch
26+
2227
```bash
2328
make coverage
2429
```
2530

26-
* Push to your fork and [submit a pull request](https://github.com/yoanm/php-jsonrpc-params-symfony-validator-sdk/compare/).
27-
* Wait for feedback or merge.
31+
* Push to your fork and [submit a pull request](https://github.com/yoanm/php-jsonrpc-params-symfony-validator-sdk/compare/).
32+
* Wait for feedback or merge.
33+
34+
Some stuff that will increase your pull request's acceptance:
2835

29-
Some stuff that will increase your pull request's acceptance:
30-
* Write tests.
31-
* Follow PSR-2 coding style.
32-
* Write good commit messages.
33-
* Do not rebase or squash your commits when a review has been made.
36+
* Write tests.
37+
* Follow PSR-2 coding style.
38+
* Write good commit messages.
39+
* Do not rebase or squash your commits when a review has been made.

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,13 @@ scrutinizer-behat:
109109
create-build-directories:
110110
mkdir -p ${PHPUNIT_COVERAGE_DIRECTORY} ${BEHAT_COVERAGE_DIRECTORY} ${REPORTS_DIRECTORY}
111111

112+
.PHONY: configure-dev-env
113+
configure-dev-env:
114+
npm install --global remark-cli remark-preset-lint-consistent remark-preset-lint-recommended remark-lint-list-item-indent
115+
116+
.PHONY: lint-markdown
117+
lint-markdown:
118+
npx remark . --output
119+
112120
.PHONY: build install configure test test-unit test-functional codestyle create-build-directories scrutinizer-behat scrutinizer-phpunit
113121
.DEFAULT: build

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# JSON-RPC params symfony validator
2+
23
[![License](https://img.shields.io/github/license/yoanm/php-jsonrpc-params-symfony-validator-sdk.svg)](https://github.com/yoanm/php-jsonrpc-params-symfony-validator-sdk)
34
[![Code size](https://img.shields.io/github/languages/code-size/yoanm/php-jsonrpc-params-symfony-validator-sdk.svg)](https://github.com/yoanm/php-jsonrpc-params-symfony-validator-sdk)
4-
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github\&repo=yoanm/php-jsonrpc-params-symfony-validator-sdk)](https://dependabot.com)
5+
![Dependabot Status](https://flat.badgen.net/github/dependabot/yoanm/php-jsonrpc-params-symfony-validator-sdk)
6+
![Last commit](https://badgen.net/github/last-commit/yoanm/php-jsonrpc-params-symfony-validator-sdk)
57

68
[![Scrutinizer Build Status](https://img.shields.io/scrutinizer/build/g/yoanm/php-jsonrpc-params-symfony-validator-sdk.svg?label=Scrutinizer\&logo=scrutinizer)](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/build-status/master)
79
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/master.svg?logo=scrutinizer)](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/?branch=master)
@@ -14,7 +16,6 @@
1416
[![Latest Stable Version](https://img.shields.io/packagist/v/yoanm/jsonrpc-params-symfony-validator-sdk.svg)](https://packagist.org/packages/yoanm/jsonrpc-params-symfony-validator-sdk)
1517
[![Packagist PHP version](https://img.shields.io/packagist/php-v/yoanm/jsonrpc-params-symfony-validator-sdk.svg)](https://packagist.org/packages/yoanm/jsonrpc-params-symfony-validator-sdk)
1618

17-
1819
Simple JSON-RPC params validator that use Symfony validator component
1920

2021
See [yoanm/symfony-jsonrpc-params-validator](https://github.com/yoanm/symfony-jsonrpc-params-validator) for automatic dependency injection.
@@ -23,23 +24,27 @@ See [yoanm/jsonrpc-params-symfony-constraint-doc-sdk](https://github.com/yoanm/p
2324

2425
## Versions
2526

26-
* Symfony v3/4 - PHP >=7.1 : `^v1.0`
27-
* Symfony v4/5 - PHP >=7.2 : `^v2.0`
27+
* Symfony v3/4 - PHP >=7.1 : `^v1.0`
28+
29+
* Symfony v4/5 - PHP >=7.2 : `^v2.0`
2830

29-
⚠️⚠️ `v0.2.0` is replaced by `v1.0.0` ! ⚠️⚠️
31+
⚠️⚠️ `v0.2.0` is replaced by `v1.0.0` ! ⚠️⚠️
3032

31-
⚠️⚠️ `v0.3.0` was badly taggued, used `v2.0.0` instead ! ⚠️⚠️
33+
⚠️⚠️ `v0.3.0` was badly taggued, used `v2.0.0` instead ! ⚠️⚠️
3234

33-
* Symfony v4.4/5.4/6.0 - PHP ^8.0 : `^v2.1`
35+
* Symfony v4.4/5.4/6.0 - PHP ^8.0 : `^v2.1`
3436

3537
## How to use
3638

37-
In order to be validated, a JSON-RPC method must :
38-
* Implements `JsonRpcMethodInterface` from [`yoanm/jsonrpc-server-sdk`](https://github.com/yoanm/php-jsonrpc-server-sdk)
39-
* Implements [`MethodWithValidatedParamsInterface`](./src/Infra/JsonRpcParamsValidator.php)
39+
In order to be validated, a JSON-RPC method must :
40+
41+
* Implements `JsonRpcMethodInterface` from [`yoanm/jsonrpc-server-sdk`](https://github.com/yoanm/php-jsonrpc-server-sdk)
42+
* Implements [`MethodWithValidatedParamsInterface`](./src/Infra/JsonRpcParamsValidator.php)
4043

4144
### With [`yoanm/jsonrpc-server-sdk`](https://github.com/yoanm/php-jsonrpc-server-sdk)
42-
Create the validator and inject it into request handler :
45+
46+
Create the validator and inject it into request handler :
47+
4348
```php
4449
$requestHandler->setMethodParamsValidator(
4550
new JsonRpcParamsValidator(
@@ -50,7 +55,8 @@ $requestHandler->setMethodParamsValidator(
5055

5156
Then you can send JSON-RPC request string to the server and any method wich implements `MethodWithValidatedParamsInterface` will be validated.
5257

53-
### Standalone
58+
### Standalone
59+
5460
```php
5561
use Symfony\Component\Validator\ValidatorBuilder;
5662
use Yoanm\JsonRpcParamsSymfonyValidator\Infra\JsonRpcParamsValidator;
@@ -65,6 +71,7 @@ $violationList = $paramsValidator->validate($jsonRpcRequest, $jsonRpcMethod);
6571
```
6672

6773
### Params validation example
74+
6875
```php
6976
use Symfony\Component\Validator\Constraint;
7077
use Symfony\Component\Validator\Constraints\Collection;
@@ -98,7 +105,9 @@ class MethodExample implements JsonRpcMethodInterface, MethodWithValidatedParams
98105
```
99106

100107
### Violations format
108+
101109
Each violations will have the following format :
110+
102111
```php
103112
[
104113
'path' => 'property_path',
@@ -108,4 +117,5 @@ Each violations will have the following format :
108117
```
109118

110119
## Contributing
120+
111121
See [contributing note](./CONTRIBUTING.md)

phpunit.xml.dist

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
32
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
43
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
65
backupStaticAttributes="false"
76
colors="true"
87
processIsolation="false"
@@ -23,23 +22,21 @@
2322
forceCoversAnnotation="true"
2423

2524
bootstrap="vendor/autoload.php"
26-
>
27-
<listeners>
28-
<listener class="Yoanm\PhpUnitExtended\Listener\YoanmTestsStrategyListener"/>
29-
</listeners>
30-
31-
<testsuites>
32-
<testsuite name="functional">
33-
<directory>tests/Functional/*</directory>
34-
</testsuite>
35-
<testsuite name="technical">
36-
<directory>tests/Technical/*</directory>
37-
</testsuite>
38-
</testsuites>
39-
40-
<filter>
41-
<whitelist>
42-
<directory>src</directory>
43-
</whitelist>
44-
</filter>
25+
>
26+
<coverage>
27+
<include>
28+
<directory>src</directory>
29+
</include>
30+
</coverage>
31+
<listeners>
32+
<listener class="Yoanm\PhpUnitExtended\Listener\YoanmTestsStrategyListener"/>
33+
</listeners>
34+
<testsuites>
35+
<testsuite name="functional">
36+
<directory>tests/Functional</directory>
37+
</testsuite>
38+
<testsuite name="technical">
39+
<directory>tests/Technical</directory>
40+
</testsuite>
41+
</testsuites>
4542
</phpunit>

0 commit comments

Comments
 (0)