Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a8f0cec

Browse files
authored
v0.0.1-alpha
1 parent 0147fce commit a8f0cec

File tree

14 files changed

+399
-0
lines changed

14 files changed

+399
-0
lines changed

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor
2+
build
3+
#A library must not provide a composer.lock file
4+
composer.lock

‎.scrutinizer.yml‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
build_failure_conditions:
2+
- 'project.metric_change("scrutinizer.quality", < -0.30)'
3+
- 'elements.rating(<= D).exists' # No classes/methods with a rating of D or worse
4+
- 'issues.severity(>= MAJOR).exists' # New major or higher severity issues
5+
- 'project.metric("scrutinizer.quality", < 9)' # Code Quality Rating drops below 9
6+
- 'project.metric("scrutinizer.test_coverage", < 1)' # Code Coverage must alway be 100%
7+
- 'patches.label("Doc Comments").exists' # No doc comments patches allowed
8+
- 'patches.label("Spacing").exists' # No spacing patches allowed
9+
- 'patches.label("Bug").exists' # No bug patches allowed
10+
- 'issues.label("coding-style").exists' # No coding style issues allowed
11+
build:
12+
dependencies:
13+
override:
14+
- make build
15+
tests:
16+
stop_on_failure: true
17+
override:
18+
- php-scrutinizer-run --enable-security-analysis
19+
-
20+
command: make codestyle
21+
analysis:
22+
file: 'build/reports/cs-data'
23+
format: 'php-cs-checkstyle'
24+
-
25+
command: make coverage
26+
idle_timeout: 1200
27+
coverage:
28+
file: 'build/coverage/clover.xml'
29+
format: 'php-clover'
30+
cache:
31+
directories:
32+
- ~/.composer
33+
- vendor
34+
35+
environment:
36+
variables:
37+
CI: 'true'
38+
TEST_OUTPUT_STYLE: 'pretty'
39+
COMPOSER_OPTIONS: '--optimize-autoloader'
40+
COVERAGE_OUTPUT_STYLE: 'clover'
41+
COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml'
42+
PHPCS_REPORT_STYLE: 'checkstyle'
43+
PHPCS_REPORT_FILE: 'build/reports/cs-data'
44+
php:
45+
version: "7.1"
46+
timezone: UTC
47+
postgresql: false
48+
redis: false
49+
filter:
50+
paths:
51+
- src/*
52+
checks:
53+
php:
54+
code_rating: true
55+
duplication: true
56+
no_debug_code: true
57+
check_method_contracts:
58+
verify_interface_like_constraints: true
59+
verify_documented_constraints: true
60+
verify_parent_constraints: true
61+
simplify_boolean_return: true
62+
return_doc_comments: true
63+
return_doc_comment_if_not_inferrable: true
64+
remove_extra_empty_lines: true
65+
properties_in_camelcaps: true
66+
phpunit_assertions: true
67+
parameters_in_camelcaps: true
68+
parameter_doc_comments: true
69+
param_doc_comment_if_not_inferrable: true
70+
overriding_parameter: true
71+
no_trailing_whitespace: true
72+
no_short_variable_names:
73+
minimum: '3'
74+
no_short_method_names:
75+
minimum: '3'
76+
no_long_variable_names:
77+
maximum: '20'
78+
no_goto: true
79+
naming_conventions:
80+
local_variable: '^[a-z][a-zA-Z0-9]*$'
81+
abstract_class_name: ^Abstract|Factory$
82+
utility_class_name: 'Utils?$'
83+
constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$'
84+
property_name: '^[a-z][a-zA-Z0-9]*$'
85+
method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$'
86+
parameter_name: '^[a-z][a-zA-Z0-9]*$'
87+
interface_name: '^[A-Z][a-zA-Z0-9]*Interface$'
88+
type_name: '^[A-Z][a-zA-Z0-9]*$'
89+
exception_name: '^[A-Z][a-zA-Z0-9]*Exception$'
90+
isser_method_name: '^(?:is|has|should|may|supports)'
91+
more_specific_types_in_doc_comments: true
92+
fix_doc_comments: false

‎.travis.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
language: php
2+
3+
php:
4+
- '7.0'
5+
- '7.1'
6+
- '7.2'
7+
8+
env:
9+
global:
10+
CI: 'true'
11+
TEST_OUTPUT_STYLE: 'pretty'
12+
PHPCS_REPORT_STYLE: 'full'
13+
COMPOSER_OPTIONS: '--optimize-autoloader'
14+
15+
sudo: false
16+
17+
matrix:
18+
fast_finish: true
19+
20+
before_install:
21+
# remove xdebug to speed up build
22+
- phpenv config-rm xdebug.ini
23+
24+
install:
25+
- make build
26+
script:
27+
- make test-technical
28+
- make test-functional
29+
30+
cache:
31+
directories:
32+
- $HOME/.composer
33+
- vendor

‎CONTRIBUTING.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Contributing
2+
3+
## Getting Started
4+
* Fork, then clone the repo:
5+
```bash
6+
git clone git@github.com:your-username/php-jsonrpc-params-symfony-validator-sdk.git
7+
````
8+
9+
* Make sure everything goes well:
10+
```bash
11+
make build
12+
make test
13+
```
14+
15+
* Make your changes (Add/Update tests according to your changes).
16+
* Make sure tests are still green:
17+
```bash
18+
make test
19+
```
20+
21+
* To check code coverage, launch
22+
```bash
23+
make coverage
24+
```
25+
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.
28+
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.

‎Makefile‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
COLOR_ENABLED ?= true
2+
TEST_OUTPUT_STYLE ?= dot
3+
COVERAGE_OUTPUT_STYLE ?= html
4+
5+
## DIRECTORY AND FILE
6+
BUILD_DIRECTORY ?= build
7+
REPORTS_DIRECTORY ?= ${BUILD_DIRECTORY}/reports
8+
COVERAGE_DIRECTORY ?= ${BUILD_DIRECTORY}/coverage
9+
COVERAGE_CLOVER_FILE_PATH ?= ${COVERAGE_DIRECTORY}/clover.xml
10+
11+
## Commands options
12+
### Composer
13+
#COMPOSER_OPTIONS=
14+
### Phpcs
15+
PHPCS_REPORT_STYLE ?= full
16+
#PHPCS_REPORT_FILE=
17+
#PHPCS_REPORT_FILE_OPTION=
18+
19+
# Enable/Disable color ouput
20+
ifeq ("${COLOR_ENABLED}","true")
21+
PHPUNIT_COLOR_OPTION ?= --colors=always
22+
BEHAT_COLOR_OPTION ?= --colors
23+
PHPCS_COLOR_OPTION ?= --colors
24+
COMPOSER_COLOR_OPTION ?= --ansi
25+
else
26+
PHPUNIT_COLOR_OPTION ?= --colors=never
27+
PHPCS_COLOR_OPTION ?= --no-colors
28+
BEHAT_COLOR_OPTION ?= --no-colors
29+
COMPOSER_COLOR_OPTION ?= --no-ansi
30+
endif
31+
32+
ifeq ("${TEST_OUTPUT_STYLE}","pretty")
33+
PHPUNIT_OUTPUT_STYLE_OPTION ?= --testdox
34+
BEHAT_OUTPUT_STYLE_OPTION ?= --format pretty
35+
else
36+
PHPUNIT_OUTPUT_STYLE_OPTION ?=
37+
BEHAT_OUTPUT_STYLE_OPTION ?= --format progress
38+
endif
39+
40+
ifeq ("${COVERAGE_OUTPUT_STYLE}","clover")
41+
PHPUNIT_COVERAGE_OPTION ?= --coverage-clover ${COVERAGE_CLOVER_FILE_PATH}
42+
else
43+
ifeq ("${COVERAGE_OUTPUT_STYLE}","html")
44+
PHPUNIT_COVERAGE_OPTION ?= --coverage-html ${COVERAGE_DIRECTORY}
45+
else
46+
PHPUNIT_COVERAGE_OPTION ?= --coverage-text
47+
endif
48+
endif
49+
50+
ifneq ("${PHPCS_REPORT_FILE}","")
51+
PHPCS_REPORT_FILE_OPTION ?= --report-file=${PHPCS_REPORT_FILE}
52+
endif
53+
54+
55+
## Project build (install and configure)
56+
build: install configure
57+
58+
## Project installation
59+
install:
60+
composer install ${COMPOSER_COLOR_OPTION} ${COMPOSER_OPTIONS} --prefer-dist --no-suggest --no-interaction
61+
62+
## project Configuration
63+
configure:
64+
65+
# Project tests
66+
test:
67+
make test-functional
68+
make test-technical
69+
make codestyle
70+
71+
test-technical:
72+
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} --testsuite technical
73+
74+
test-functional:
75+
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} --testsuite functional
76+
./vendor/bin/behat ${BEHAT_COLOR_OPTION} ${BEHAT_OUTPUT_STYLE_OPTION} --no-snippets
77+
78+
codestyle: create-reports-directory
79+
./vendor/bin/phpcs --standard=phpcs.xml.dist ${PHPCS_COLOR_OPTION} ${PHPCS_REPORT_FILE_OPTION} --report=${PHPCS_REPORT_STYLE}
80+
81+
coverage: create-coverage-directory
82+
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} ${PHPUNIT_COVERAGE_OPTION}
83+
84+
85+
86+
# Internal commands
87+
create-coverage-directory:
88+
mkdir -p ${COVERAGE_DIRECTORY}
89+
90+
create-reports-directory:
91+
mkdir -p ${REPORTS_DIRECTORY}
92+
93+
94+
.PHONY: build install configure test test-technical test-functional codestyle coverage create-coverage-directory create-reports-directory
95+
.DEFAULT: build

‎README.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# JSON-RPC params symfony validator
2+
[![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) [![PHP Versions](https://img.shields.io/badge/php-7.0%20%2F%207.1%20%2F%207.2-8892BF.svg)](https://php.net/)
3+
4+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/badges/build.png?b=master)](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/build-status/master) [![Code Coverage](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-params-symfony-validator-sdk/?branch=master)
5+
6+
[![Travis Build Status](https://img.shields.io/travis/yoanm/php-jsonrpc-params-symfony-validator-sdk/master.svg?label=travis)](https://travis-ci.org/yoanm/php-jsonrpc-params-symfony-validator-sdk) [![Travis PHP versions](https://img.shields.io/travis/php-v/yoanm/php-jsonrpc-params-symfony-validator-sdk.svg)](https://travis-ci.org/yoanm/php-jsonrpc-params-symfony-validator-sdk)
7+
8+
[![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)
9+
10+
Simple JSON-RPC params validator that use Symfony validator component
11+
12+
## How to use
13+
14+
15+
## Contributing
16+
See [contributing note](./CONTRIBUTING.md)

‎behat.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
default:
2+
suites:
3+
default:
4+
contexts:
5+
- Tests\Functional\BehatContext\FeatureContext: ~

‎composer.json‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "yoanm/jsonrpc-params-symfony-validator-sdk",
3+
"description": "Symfony Server SDK to convert an HTTP json-rpc request into HTTP json-rpc response",
4+
"license": "GPL-3.0-only",
5+
"type": "library",
6+
"support": {
7+
"issues": "https://github.com/yoanm/php-jsonrpc-params-symfony-validator-sdk/issues"
8+
},
9+
"authors": [
10+
{
11+
"name": "Yoanm",
12+
"email": "yoanm@users.noreply.github.com",
13+
"role": "Developer"
14+
}
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"Yoanm\\JsonRpcParamsSymfonyValidator\\": "src"
19+
}
20+
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"Tests\\": "tests",
24+
"Tests\\Functional\\BehatContext\\": "features/bootstrap"
25+
}
26+
},
27+
"require": {
28+
"php": ">5.5",
29+
"yoanm/jsonrpc-server-sdk": "~2.0",
30+
"symfony/validator": "^3.0 || ^4.0"
31+
},
32+
"suggest": {
33+
"yoanm/jsonrpc-server-doc-sdk": "To generate payload documentation from validation constraints",
34+
"yoanm/symfony-jsonrpc-server-doc": "For automatic payload documentation"
35+
},
36+
"require-dev": {
37+
"behat/behat": "~3.0",
38+
"squizlabs/php_codesniffer": "3.*",
39+
"phpunit/phpunit": "^6.0 || ^7.0",
40+
"matthiasnoback/symfony-dependency-injection-test": "^2.0 || ^3.0",
41+
"matthiasnoback/symfony-config-test": "^3.0 || ^4.0",
42+
"symfony/framework-bundle": "^3.4",
43+
"symfony/http-kernel": "^3.4",
44+
"symfony/routing": "^3.4",
45+
"yoanm/php-unit-extended": "~1.0",
46+
"yoanm/jsonrpc-server-doc-sdk": "dev-master"
47+
}
48+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace Tests\Functional\BehatContext;
3+
4+
use Behat\Behat\Context\Context;
5+
6+
/**
7+
* Defines application features from the specific context.
8+
*/
9+
class FeatureContext implements Context
10+
{
11+
12+
}

‎phpcs.xml.dist‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="php-jsonrpc-params-symfony-validator-sdk">
3+
<file>src</file>
4+
<file>tests</file>
5+
<file>features/bootstrap</file>
6+
7+
<arg value="p"/>
8+
<arg name="colors"/>
9+
<arg name="extensions" value="php"/>
10+
11+
<rule ref="PSR2"/>
12+
</ruleset>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /