Skip to content

Commit 9b7f5be

Browse files
committed
Init
1 parent da166d9 commit 9b7f5be

15 files changed

+428
-1
lines changed

.gitignore

+4
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

+92
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

+33
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

+33
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 [email protected]:your-username/symfony-jsonrpc-http-server-doc.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/symfony-jsonrpc-http-server-doc/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.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Yo
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+95
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

+17-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
# symfony-jsonrpc-http-server-doc
1+
# JSON-RPC server documentation
2+
[![License](https://img.shields.io/github/license/yoanm/symfony-jsonrpc-http-server-doc.svg)](https://github.com/yoanm/symfony-jsonrpc-http-server-doc) [![Code size](https://img.shields.io/github/languages/code-size/yoanm/symfony-jsonrpc-http-server-doc.svg)](https://github.com/yoanm/symfony-jsonrpc-http-server-doc) [![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/symfony-jsonrpc-http-server-doc/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-doc/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-doc/badges/build.png?b=master)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-doc/build-status/master) [![Code Coverage](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-doc/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-doc/?branch=master)
5+
6+
[![Travis Build Status](https://img.shields.io/travis/yoanm/symfony-jsonrpc-http-server-doc/master.svg?label=travis)](https://travis-ci.org/yoanm/symfony-jsonrpc-http-server-doc) [![Travis PHP versions](https://img.shields.io/travis/php-v/yoanm/symfony-jsonrpc-http-server-doc.svg)](https://travis-ci.org/yoanm/symfony-jsonrpc-http-server-doc)
7+
8+
[![Latest Stable Version](https://img.shields.io/packagist/v/yoanm/symfony-jsonrpc-http-server-doc.svg)](https://packagist.org/packages/yoanm/symfony-jsonrpc-http-server-doc) [![Packagist PHP version](https://img.shields.io/packagist/php-v/yoanm/symfony-jsonrpc-http-server-doc.svg)](https://packagist.org/packages/yoanm/symfony-jsonrpc-http-server-doc)
9+
10+
Symfony bundle for easy JSON-RPC server documentation
11+
12+
## How to use
13+
14+
 
15+
16+
## Contributing
17+
See [contributing note](./CONTRIBUTING.md)

behat.yml

+5
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

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "yoanm/symfony-jsonrpc-http-server-doc",
3+
"description": "Symfony bundle for easy JSON-RPC server documentation",
4+
"license": "MIT",
5+
"type": "library",
6+
"support": {
7+
"issues": "https://github.com/yoanm/symfony-jsonrpc-http-server-doc/issues"
8+
},
9+
"authors": [
10+
{
11+
"name": "Yoanm",
12+
"email": "[email protected]",
13+
"role": "Developer"
14+
}
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"Yoanm\\SymfonyJsonRpcHttpServerDoc\\": "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+
"yoanm/jsonrpc-server-doc-sdk": "dev-master",
31+
"yoanm/symfony-jsonrpc-http-server": "dev-master",
32+
"symfony/http-foundation": "^3.0 || ^4.0",
33+
"symfony/http-kernel": "^3.0 || ^4.0",
34+
"symfony/config": "^3.0 || ^4.0",
35+
"symfony/dependency-injection": "^3.0 || ^4.0"
36+
},
37+
"require-dev": {
38+
"behat/behat": "~3.0",
39+
"squizlabs/php_codesniffer": "3.*",
40+
"phpunit/phpunit": "^6.0 || ^7.0",
41+
"matthiasnoback/symfony-dependency-injection-test": "^2.0 || ^3.0",
42+
"matthiasnoback/symfony-config-test": "^3.0 || ^4.0",
43+
"symfony/framework-bundle": "^3.4",
44+
"yoanm/php-unit-extended": "~1.0"
45+
}
46+
}

features/bootstrap/FeatureContext.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
* Initializes context.
13+
*
14+
* Every scenario gets its own context instance.
15+
* You can also pass arbitrary arguments to the
16+
* context constructor through behat.yml.
17+
*/
18+
public function __construct()
19+
{
20+
}
21+
}

phpcs.xml.dist

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Symfony-jsonrpc-http-server-doc">
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)