Skip to content

Init #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vendor
build
#A library must not provide a composer.lock file
composer.lock
92 changes: 92 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
build_failure_conditions:
- 'project.metric_change("scrutinizer.quality", < -0.30)'
- 'elements.rating(<= D).exists' # No classes/methods with a rating of D or worse
- 'issues.severity(>= MAJOR).exists' # New major or higher severity issues
- 'project.metric("scrutinizer.quality", < 9)' # Code Quality Rating drops below 9
- 'project.metric("scrutinizer.test_coverage", < 1)' # Code Coverage must alway be 100%
- 'patches.label("Doc Comments").exists' # No doc comments patches allowed
- 'patches.label("Spacing").exists' # No spacing patches allowed
- 'patches.label("Bug").exists' # No bug patches allowed
- 'issues.label("coding-style").exists' # No coding style issues allowed
build:
dependencies:
override:
- make build
tests:
stop_on_failure: true
override:
- php-scrutinizer-run --enable-security-analysis
-
command: make codestyle
analysis:
file: 'build/reports/cs-data'
format: 'php-cs-checkstyle'
-
command: make coverage
idle_timeout: 1200
coverage:
file: 'build/coverage/clover.xml'
format: 'php-clover'
cache:
directories:
- ~/.composer
- vendor

environment:
variables:
CI: 'true'
TEST_OUTPUT_STYLE: 'pretty'
COMPOSER_OPTIONS: '--optimize-autoloader'
COVERAGE_OUTPUT_STYLE: 'clover'
COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml'
PHPCS_REPORT_STYLE: 'checkstyle'
PHPCS_REPORT_FILE: 'build/reports/cs-data'
php:
version: "7.1"
timezone: UTC
postgresql: false
redis: false
filter:
paths:
- src/*
checks:
php:
code_rating: true
duplication: true
no_debug_code: true
check_method_contracts:
verify_interface_like_constraints: true
verify_documented_constraints: true
verify_parent_constraints: true
simplify_boolean_return: true
return_doc_comments: true
return_doc_comment_if_not_inferrable: true
remove_extra_empty_lines: true
properties_in_camelcaps: true
phpunit_assertions: true
parameters_in_camelcaps: true
parameter_doc_comments: true
param_doc_comment_if_not_inferrable: true
overriding_parameter: true
no_trailing_whitespace: true
no_short_variable_names:
minimum: '3'
no_short_method_names:
minimum: '3'
no_long_variable_names:
maximum: '20'
no_goto: true
naming_conventions:
local_variable: '^[a-z][a-zA-Z0-9]*$'
abstract_class_name: ^Abstract|Factory$
utility_class_name: 'Utils?$'
constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$'
property_name: '^[a-z][a-zA-Z0-9]*$'
method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$'
parameter_name: '^[a-z][a-zA-Z0-9]*$'
interface_name: '^[A-Z][a-zA-Z0-9]*Interface$'
type_name: '^[A-Z][a-zA-Z0-9]*$'
exception_name: '^[A-Z][a-zA-Z0-9]*Exception$'
isser_method_name: '^(?:is|has|should|may|supports)'
more_specific_types_in_doc_comments: true
fix_doc_comments: false
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
language: php

php:
- '7.0'
- '7.1'
- '7.2'

env:
global:
CI: 'true'
TEST_OUTPUT_STYLE: 'pretty'
PHPCS_REPORT_STYLE: 'full'
COMPOSER_OPTIONS: '--optimize-autoloader'

sudo: false

matrix:
fast_finish: true

before_install:
# remove xdebug to speed up build
- phpenv config-rm xdebug.ini

install:
- make build
script:
- make test-technical
- make test-functional

cache:
directories:
- $HOME/.composer
- vendor
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing

## Getting Started
* Fork, then clone the repo:
```bash
git clone [email protected]:your-username/symfony-jsonrpc-http-server-openapi-doc.git
````

* 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:
```bash
make test
```

* To check code coverage, launch
```bash
make coverage
```

* Push to your fork and [submit a pull request](https://github.com/yoanm/symfony-jsonrpc-http-server-openapi-doc/compare/).
* Wait for feedback or merge.

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.
95 changes: 95 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
COLOR_ENABLED ?= true
TEST_OUTPUT_STYLE ?= dot
COVERAGE_OUTPUT_STYLE ?= html

## DIRECTORY AND FILE
BUILD_DIRECTORY ?= build
REPORTS_DIRECTORY ?= ${BUILD_DIRECTORY}/reports
COVERAGE_DIRECTORY ?= ${BUILD_DIRECTORY}/coverage
COVERAGE_CLOVER_FILE_PATH ?= ${COVERAGE_DIRECTORY}/clover.xml

## Commands options
### Composer
#COMPOSER_OPTIONS=
### Phpcs
PHPCS_REPORT_STYLE ?= full
#PHPCS_REPORT_FILE=
#PHPCS_REPORT_FILE_OPTION=

# Enable/Disable color ouput
ifeq ("${COLOR_ENABLED}","true")
PHPUNIT_COLOR_OPTION ?= --colors=always
BEHAT_COLOR_OPTION ?= --colors
PHPCS_COLOR_OPTION ?= --colors
COMPOSER_COLOR_OPTION ?= --ansi
else
PHPUNIT_COLOR_OPTION ?= --colors=never
PHPCS_COLOR_OPTION ?= --no-colors
BEHAT_COLOR_OPTION ?= --no-colors
COMPOSER_COLOR_OPTION ?= --no-ansi
endif

ifeq ("${TEST_OUTPUT_STYLE}","pretty")
PHPUNIT_OUTPUT_STYLE_OPTION ?= --testdox
BEHAT_OUTPUT_STYLE_OPTION ?= --format pretty
else
PHPUNIT_OUTPUT_STYLE_OPTION ?=
BEHAT_OUTPUT_STYLE_OPTION ?= --format progress
endif

ifeq ("${COVERAGE_OUTPUT_STYLE}","clover")
PHPUNIT_COVERAGE_OPTION ?= --coverage-clover ${COVERAGE_CLOVER_FILE_PATH}
else
ifeq ("${COVERAGE_OUTPUT_STYLE}","html")
PHPUNIT_COVERAGE_OPTION ?= --coverage-html ${COVERAGE_DIRECTORY}
else
PHPUNIT_COVERAGE_OPTION ?= --coverage-text
endif
endif

ifneq ("${PHPCS_REPORT_FILE}","")
PHPCS_REPORT_FILE_OPTION ?= --report-file=${PHPCS_REPORT_FILE}
endif


## Project build (install and configure)
build: install configure

## Project installation
install:
composer install ${COMPOSER_COLOR_OPTION} ${COMPOSER_OPTIONS} --prefer-dist --no-suggest --no-interaction

## project Configuration
configure:

# Project tests
test:
make test-functional
make test-technical
make codestyle

test-technical:
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} --testsuite technical

test-functional:
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} --testsuite functional
./vendor/bin/behat ${BEHAT_COLOR_OPTION} ${BEHAT_OUTPUT_STYLE_OPTION} --no-snippets

codestyle: create-reports-directory
./vendor/bin/phpcs --standard=phpcs.xml.dist ${PHPCS_COLOR_OPTION} ${PHPCS_REPORT_FILE_OPTION} --report=${PHPCS_REPORT_STYLE}

coverage: create-coverage-directory
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} ${PHPUNIT_COVERAGE_OPTION}



# Internal commands
create-coverage-directory:
mkdir -p ${COVERAGE_DIRECTORY}

create-reports-directory:
mkdir -p ${REPORTS_DIRECTORY}


.PHONY: build install configure test test-technical test-functional codestyle coverage create-coverage-directory create-reports-directory
.DEFAULT: build
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Symfony JSON-RPC Http server OpenAPI documentation

[![License](https://img.shields.io/github/license/yoanm/symfony-jsonrpc-http-server-openapi-doc.svg)](https://github.com/yoanm/symfony-jsonrpc-http-server-openapi-doc) [![Code size](https://img.shields.io/github/languages/code-size/yoanm/symfony-jsonrpc-http-server-openapi-doc.svg)](https://github.com/yoanm/symfony-jsonrpc-http-server-openapi-doc) [![PHP Versions](https://img.shields.io/badge/php-7.0%20%2F%207.1%20%2F%207.2-8892BF.svg)](https://php.net/)

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-openapi-doc/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-openapi-doc/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-openapi-doc/badges/build.png?b=master)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-openapi-doc/build-status/master) [![Code Coverage](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-openapi-doc/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-openapi-doc/?branch=master)

[![Travis Build Status](https://img.shields.io/travis/yoanm/symfony-jsonrpc-http-server-openapi-doc/master.svg?label=travis)](https://travis-ci.org/yoanm/symfony-jsonrpc-http-server-openapi-doc) [![Travis PHP versions](https://img.shields.io/travis/php-v/yoanm/symfony-jsonrpc-http-server-openapi-doc.svg)](https://travis-ci.org/yoanm/symfony-jsonrpc-http-server-openapi-doc)

[![Latest Stable Version](https://img.shields.io/packagist/v/yoanm/symfony-jsonrpc-http-server-openapi-doc.svg)](https://packagist.org/packages/yoanm/symfony-jsonrpc-http-server-openapi-doc) [![Packagist PHP version](https://img.shields.io/packagist/php-v/yoanm/symfony-jsonrpc-http-server-openapi-doc.svg)](https://packagist.org/packages/yoanm/symfony-jsonrpc-http-server-openapi-doc)

Symfony bundle for easy JSON-RPC server OpenAPI 3.0.0 documentation

## How to use


## Contributing
See [contributing note](./CONTRIBUTING.md)
5 changes: 5 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
default:
suites:
default:
contexts:
- Tests\Functional\BehatContext\FeatureContext: ~
46 changes: 46 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "yoanm/symfony-jsonrpc-http-server-openapi-doc",
"description": "Symfony bundle for easy JSON-RPC server OpenAPI 3.0.0 documentation",
"license": "MIT",
"type": "library",
"support": {
"issues": "https://github.com/yoanm/symfony-jsonrpc-http-server-openapi-doc/issues"
},
"authors": [
{
"name": "Yoanm",
"email": "[email protected]",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Yoanm\\SymfonyJsonRpcHttpServerOpenAPIDoc\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests",
"Tests\\Functional\\BehatContext\\": "features/bootstrap"
}
},
"require": {
"php": ">=5.5",
"yoanm/jsonrpc-server-doc-sdk": "dev-feature/improve",
"yoanm/jsonrpc-http-server-openapi-doc-sdk": "dev-feature/improve",
"yoanm/symfony-jsonrpc-http-server-doc": "dev-feature/improve",
"symfony/http-foundation": "^3.0 || ^4.0",
"symfony/http-kernel": "^3.0 || ^4.0",
"symfony/config": "^3.0 || ^4.0",
"symfony/dependency-injection": "^3.0 || ^4.0"
},
"require-dev": {
"behat/behat": "~3.0",
"squizlabs/php_codesniffer": "3.*",
"phpunit/phpunit": "^6.0 || ^7.0",
"matthiasnoback/symfony-dependency-injection-test": "^2.0 || ^3.0",
"matthiasnoback/symfony-config-test": "^3.0 || ^4.0",
"symfony/framework-bundle": "^3.4",
"yoanm/php-unit-extended": "~1.0"
}
}
21 changes: 21 additions & 0 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
namespace Tests\Functional\BehatContext;

use Behat\Behat\Context\Context;

/**
* Defines application features from the specific context.
*/
class FeatureContext implements Context
{
/**
* Initializes context.
*
* Every scenario gets its own context instance.
* You can also pass arbitrary arguments to the
* context constructor through behat.yml.
*/
public function __construct()
{
}
}
12 changes: 12 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<ruleset name="Symfony-jsonrpc-http-server-openapi-doc">
<file>src</file>
<file>tests</file>
<file>features/bootstrap</file>

<arg value="p"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>

<rule ref="PSR2"/>
</ruleset>
Loading