From 95c61170dc64b5e40853c55e6ed0b40921c420f0 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Tue, 2 Sep 2025 23:08:41 +0200 Subject: [PATCH] Harmonize CI & files --- .gitignore | 4 ++++ .remarkrc | 6 +++++- .scrutinizer.yml | 1 - CODE_OF_CONDUCT.md | 6 +++--- CONTRIBUTING.md | 32 +++++++++++++++++++------------- Makefile | 8 ++++++++ README.md | 34 ++++++++++++++++++++++------------ phpunit.xml.dist | 39 ++++++++++++++++++--------------------- 8 files changed, 79 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index 457cea1..4cb177e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,9 @@ vendor build #A library must not provide a composer.lock file composer.lock + +# Demo app excluded dirs +features/demo_app/var/ + #Phpunit .phpunit.result.cache diff --git a/.remarkrc b/.remarkrc index 0527df5..5bf1fca 100644 --- a/.remarkrc +++ b/.remarkrc @@ -1,6 +1,10 @@ { "plugins": [ "remark-preset-lint-consistent", - "remark-preset-lint-recommended" + "remark-preset-lint-recommended", + [ + "remark-lint-list-item-indent", + "space" + ] ] } diff --git a/.scrutinizer.yml b/.scrutinizer.yml index b579dd2..938ad6a 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -41,7 +41,6 @@ build: variables: CI: 'true' TEST_OUTPUT_STYLE: 'pretty' - COMPOSER_OPTIONS: '--optimize-autoloader' COVERAGE_OUTPUT_STYLE: 'clover' COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml' PHPCS_DISABLE_WARNING: 'true' diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index c4f2952..2d53c83 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -23,13 +23,13 @@ include: Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or - advances + advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic - address, without explicit permission + address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a - professional setting + professional setting ## Our Responsibilities diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 86dc163..8b86e31 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,33 +1,39 @@ # Contributing ## Getting Started - * Fork, then clone the repo: + +* Fork, then clone the repo: + ```bash git clone git@github.com:your-username/php-jsonrpc-params-symfony-validator-sdk.git -```` +``` + +* Make sure everything goes well: - * Make sure everything goes well: ```bash make build make test ``` - * Make your changes (Add/Update tests according to your changes). - * Make sure tests are still green: +* Make your changes (Add/Update tests according to your changes). +* Make sure tests are still green: + ```bash make test ``` - * To check code coverage, launch +* To check code coverage, launch + ```bash make coverage ``` - * Push to your fork and [submit a pull request](https://github.com/yoanm/php-jsonrpc-params-symfony-validator-sdk/compare/). - * Wait for feedback or merge. +* Push to your fork and [submit a pull request](https://github.com/yoanm/php-jsonrpc-params-symfony-validator-sdk/compare/). +* Wait for feedback or merge. + +Some stuff that will increase your pull request's acceptance: - Some stuff that will increase your pull request's acceptance: - * Write tests. - * Follow PSR-2 coding style. - * Write good commit messages. - * Do not rebase or squash your commits when a review has been made. +* Write tests. +* Follow PSR-2 coding style. +* Write good commit messages. +* Do not rebase or squash your commits when a review has been made. diff --git a/Makefile b/Makefile index fdbc8a1..0c3c84f 100644 --- a/Makefile +++ b/Makefile @@ -109,5 +109,13 @@ scrutinizer-behat: create-build-directories: mkdir -p ${PHPUNIT_COVERAGE_DIRECTORY} ${BEHAT_COVERAGE_DIRECTORY} ${REPORTS_DIRECTORY} +.PHONY: configure-dev-env +configure-dev-env: + npm install --global remark-cli remark-preset-lint-consistent remark-preset-lint-recommended remark-lint-list-item-indent + +.PHONY: lint-markdown +lint-markdown: + npx remark . --output + .PHONY: build install configure test test-unit test-functional codestyle create-build-directories scrutinizer-behat scrutinizer-phpunit .DEFAULT: build diff --git a/README.md b/README.md index 619e8f1..c87e440 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # JSON-RPC params symfony validator + [![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) [![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) -[![Dependabot Status](https://api.dependabot.com/badges/status?host=github\&repo=yoanm/php-jsonrpc-params-symfony-validator-sdk)](https://dependabot.com) +![Dependabot Status](https://flat.badgen.net/github/dependabot/yoanm/php-jsonrpc-params-symfony-validator-sdk) +![Last commit](https://badgen.net/github/last-commit/yoanm/php-jsonrpc-params-symfony-validator-sdk) [![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) [![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 @@ [![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) [![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) - Simple JSON-RPC params validator that use Symfony validator component 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 ## Versions -* Symfony v3/4 - PHP >=7.1 : `^v1.0` -* Symfony v4/5 - PHP >=7.2 : `^v2.0` +* Symfony v3/4 - PHP >=7.1 : `^v1.0` + +* Symfony v4/5 - PHP >=7.2 : `^v2.0` - ⚠️⚠️ `v0.2.0` is replaced by `v1.0.0` ! ⚠️⚠️ + ⚠️⚠️ `v0.2.0` is replaced by `v1.0.0` ! ⚠️⚠️ - ⚠️⚠️ `v0.3.0` was badly taggued, used `v2.0.0` instead ! ⚠️⚠️ + ⚠️⚠️ `v0.3.0` was badly taggued, used `v2.0.0` instead ! ⚠️⚠️ -* Symfony v4.4/5.4/6.0 - PHP ^8.0 : `^v2.1` +* Symfony v4.4/5.4/6.0 - PHP ^8.0 : `^v2.1` ## How to use -In order to be validated, a JSON-RPC method must : -* Implements `JsonRpcMethodInterface` from [`yoanm/jsonrpc-server-sdk`](https://github.com/yoanm/php-jsonrpc-server-sdk) -* Implements [`MethodWithValidatedParamsInterface`](./src/Infra/JsonRpcParamsValidator.php) +In order to be validated, a JSON-RPC method must : + +* Implements `JsonRpcMethodInterface` from [`yoanm/jsonrpc-server-sdk`](https://github.com/yoanm/php-jsonrpc-server-sdk) +* Implements [`MethodWithValidatedParamsInterface`](./src/Infra/JsonRpcParamsValidator.php) ### With [`yoanm/jsonrpc-server-sdk`](https://github.com/yoanm/php-jsonrpc-server-sdk) -Create the validator and inject it into request handler : + +Create the validator and inject it into request handler : + ```php $requestHandler->setMethodParamsValidator( new JsonRpcParamsValidator( @@ -50,7 +55,8 @@ $requestHandler->setMethodParamsValidator( Then you can send JSON-RPC request string to the server and any method wich implements `MethodWithValidatedParamsInterface` will be validated. -### Standalone +### Standalone + ```php use Symfony\Component\Validator\ValidatorBuilder; use Yoanm\JsonRpcParamsSymfonyValidator\Infra\JsonRpcParamsValidator; @@ -65,6 +71,7 @@ $violationList = $paramsValidator->validate($jsonRpcRequest, $jsonRpcMethod); ``` ### Params validation example + ```php use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\Collection; @@ -98,7 +105,9 @@ class MethodExample implements JsonRpcMethodInterface, MethodWithValidatedParams ``` ### Violations format + Each violations will have the following format : + ```php [ 'path' => 'property_path', @@ -108,4 +117,5 @@ Each violations will have the following format : ``` ## Contributing + See [contributing note](./CONTRIBUTING.md) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 958d0be..0b44794 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,7 @@ - - - - - - - - tests/Functional/* - - - tests/Technical/* - - - - - - src - - +> + + + src + + + + + + + + tests/Functional + + + tests/Technical + +