Skip to content

Commit be1c28c

Browse files
committed
Init
1 parent 74361c6 commit be1c28c

File tree

14 files changed

+543
-6
lines changed

14 files changed

+543
-6
lines changed

.gitignore

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
composer.phar
2-
/vendor/
3-
4-
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
5-
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
6-
# composer.lock
1+
vendor
2+
build
3+
#A library must not provide a composer.lock file
4+
composer.lock

.scrutinizer.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
before:
14+
- composer global require hirak/prestissimo
15+
override:
16+
- make build
17+
tests:
18+
stop_on_failure: true
19+
override:
20+
- php-scrutinizer-run
21+
-
22+
command: make codestyle
23+
analysis:
24+
file: 'build/reports/cs-data'
25+
format: 'php-cs-checkstyle'
26+
-
27+
command: make coverage
28+
idle_timeout: 1200
29+
coverage:
30+
file: 'build/coverage/clover.xml'
31+
format: 'php-clover'
32+
cache:
33+
directories:
34+
- ~/.composer
35+
- vendor
36+
37+
environment:
38+
variables:
39+
CI: 'true'
40+
TEST_OUTPUT_STYLE: 'pretty'
41+
COVERAGE_OUTPUT_STYLE: 'clover'
42+
COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml'
43+
PHPCS_REPORT_STYLE: 'checkstyle'
44+
PHPCS_REPORT_FILE: 'build/reports/cs-data'
45+
COMPOSER_OPTIONS: '--optimize-autoloader'
46+
php:
47+
version: "7.1"
48+
timezone: UTC
49+
postgresql: false
50+
redis: false
51+
filter:
52+
paths:
53+
- src/*
54+
checks:
55+
php:
56+
code_rating: true
57+
duplication: true
58+
no_debug_code: true
59+
check_method_contracts:
60+
verify_interface_like_constraints: true
61+
verify_documented_constraints: true
62+
verify_parent_constraints: true
63+
simplify_boolean_return: true
64+
return_doc_comments: true
65+
return_doc_comment_if_not_inferrable: true
66+
remove_extra_empty_lines: true
67+
properties_in_camelcaps: true
68+
phpunit_assertions: true
69+
parameters_in_camelcaps: true
70+
parameter_doc_comments: true
71+
param_doc_comment_if_not_inferrable: true
72+
overriding_parameter: true
73+
no_trailing_whitespace: true
74+
no_short_variable_names:
75+
minimum: '3'
76+
no_short_method_names:
77+
minimum: '3'
78+
no_long_variable_names:
79+
maximum: '20'
80+
no_goto: true
81+
naming_conventions:
82+
local_variable: '^[a-z][a-zA-Z0-9]*$'
83+
abstract_class_name: ^Abstract|Factory$
84+
utility_class_name: 'Utils?$'
85+
constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$'
86+
property_name: '^[a-z][a-zA-Z0-9]*$'
87+
method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$'
88+
parameter_name: '^[a-z][a-zA-Z0-9]*$'
89+
interface_name: '^[A-Z][a-zA-Z0-9]*Interface$'
90+
type_name: '^[A-Z][a-zA-Z0-9]*$'
91+
exception_name: '^[A-Z][a-zA-Z0-9]*Exception$'
92+
isser_method_name: '^(?:is|has|should|may|supports)'
93+
more_specific_types_in_doc_comments: true
94+
fix_doc_comments: false

.travis.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
language: php
2+
3+
php:
4+
- '7.0'
5+
- '7.1'
6+
- '7.2'
7+
8+
env:
9+
CI: 'true'
10+
TEST_OUTPUT_STYLE: 'pretty'
11+
PHPCS_REPORT_STYLE: 'full'
12+
COMPOSER_OPTIONS: '--optimize-autoloader'
13+
14+
sudo: false
15+
16+
matrix:
17+
fast_finish: true
18+
19+
install:
20+
- make build
21+
script:
22+
- make test-technical
23+
- make test-functional
24+
25+
cache:
26+
directories:
27+
- $HOME/.composer
28+
- 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/symfony-jsonrpc-http-server.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/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

0 commit comments

Comments
 (0)