Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tigitz committed Feb 10, 2019
0 parents commit b73b215
Show file tree
Hide file tree
Showing 91 changed files with 4,560 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
max_line_length = 80

[Makefile]
indent_style=tab

[*.yml]
indent_size = 2
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis export-ignore
/.github export-ignore
/.travis.yml export-ignore
/.editorconfig export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
/docs export-ignore
/docker export-ignore
/docker-compose.yml export-ignore
/Makefile export-ignore
/phpstan.neon export-ignore
18 changes: 18 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/tigitz/php-spellcheck).


## Pull Requests

- **Coding Standard** - Check the code style with ``vendor/bin/phpcs``.

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- Provide a general summary of the issue in the Title above -->

## Detailed description

Provide a detailed description of the change or addition you are proposing.

Tag the issue with it's proper type

## Context

Why is this change important to you? How would you use it?

How can it benefit other users?

## Possible implementation

Not obligatory, but suggest an idea for implementing addition or change.

## Your environment

Include as many relevant details about the environment you experienced the bug in and how to reproduce it.

* Version used (e.g. PHP 5.6, HHVM 3):
* Operating system and version (e.g. Ubuntu 16.04, Windows 7):
* Link to your project:
* ...
* ...
33 changes: 33 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description

Describe your changes in detail.

## Motivation and context

Why is this change required? What problem does it solve?

If it fixes an open issue, please link to the issue here (if you write `fixes #num`
or `closes #num`, the issue will be automatically closed when the pull is accepted.)

## How has this been tested?

Please describe in detail how you tested your changes.

Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.

## Screenshots (if appropriate)

## Checklist:

Go over all the following points before making your PR:

- [ ] I have read the **[CONTRIBUTING](CONTRIBUTING.md)** document.
- [ ] My pull request addresses exactly one patch/feature.
- [ ] I have created a branch for this patch/feature.
- [ ] I have added tests to cover my changes.
- [ ] If my change requires a change to the documentation, I have updated it accordingly.

If you're unsure about any of these, don't hesitate to ask. We're here to help!
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
composer.lock
vendor
.idea
.phpcs-cache
31 changes: 31 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
build:
nodes:
analysis:
environment:
php:
version: 7.2
cache:
disabled: false
directories:
- ~/.composer/cache
project_setup:
override: true
tests:
override:
- php-scrutinizer-run
dependencies:
override:
- composer install --no-interaction --prefer-dist

tools:
external_code_coverage:
timeout: 3600

filter:
excluded_paths:
- docs

build_failure_conditions:
- 'elements.rating(<= B).new.exists' # No new classes/methods with a rating of B or worse allowed
- 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity
- 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection
97 changes: 97 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# This triggers builds to run on the new TravisCI infrastructure.
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false

language: minimal

services:
- docker

stages:
- Smoke Testing
- Test

## Cache composer
cache:
directories:
- vendor
- $HOME/.composer/cache
- $HOME/docker

jobs:
include:
- &BASE_JOB
stage: Test
install:
- sudo service docker stop
- if [ "$(ls -A /home/travis/docker)" ]; then echo "/home/travis/docker already set"; else sudo mv /var/lib/docker /home/travis/docker; fi
- sudo bash -c "echo 'DOCKER_OPTS=\"-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -g /home/travis/docker\"' > /etc/default/docker"
- sudo service docker start
- make setup
- make vendor
env:
- DEPS=HIGHEST
- PHP_VERSION=7.3
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
script:
- make tests
after_success:
- if [[ "$WITH_COVERAGE" == true ]]; then bash <(curl -s https://codecov.io/bash); fi
- |
if [[ "PHP_VERSION" == '7.2' && "$WITH_COVERAGE" == true ]]; then
make scrutinizer
fi
before_cache:
- sudo service docker stop
- sudo chown -R travis ~/docker

- <<: *BASE_JOB
env:
- DEPS=LOWEST
- PHP_VERSION=7.3
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml

- <<: *BASE_JOB
env:
- DEPS=HIGHEST
- PHP_VERSION=7.2
- WITH_COVERAGE=true
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml

- <<: *BASE_JOB
env:
- DEPS=LOWEST
- PHP_VERSION=7.2
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml

- <<: *BASE_JOB
env:
- DEPS=HIGHEST
- PHP_VERSION=7.1
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml

- <<: *BASE_JOB
env:
- DEPS=LOWEST
- PHP_VERSION=7.1
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml

- <<: *BASE_JOB
stage: Smoke Testing
env:
- PHPSTAN
- DEPS=HIGHEST
- PHP_VERSION=7.3
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
script:
- make phpstan

- <<: *BASE_JOB
stage: Smoke Testing
env:
- PHPCS
- DEPS=HIGHEST
- PHP_VERSION=7.3
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
script:
- make phpcs
20 changes: 20 additions & 0 deletions .travis/docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.2'

services:
php7.1:
volumes:
- $HOME/.composer/cache:/root/composer/cache
environment:
- COMPOSER_CACHE_DIR=/root/composer/cache

php7.2:
volumes:
- $HOME/.composer/cache:/root/composer/cache
environment:
- COMPOSER_CACHE_DIR=/root/composer/cache

php7.3:
volumes:
- $HOME/.composer/cache:/root/composer/cache
environment:
- COMPOSER_CACHE_DIR=/root/composer/cache
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) 2018 PhpSpellCheck Project

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
66 changes: 66 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
DOCKER_COMPOSE ?= docker-compose
EXEC_PHP = $(DOCKER_COMPOSE) run --rm -T php$(PHP_VERSION)
PHP_VERSION ?= 7.3
DEPS ?= "LOCKED"
COMPOSER = $(EXEC_PHP) composer
WITH_COVERAGE ?= "FALSE"

build:
@$(DOCKER_COMPOSE) pull --parallel --ignore-pull-failures 2> /dev/null
$(DOCKER_COMPOSE) build php$(PHP_VERSION)

kill:
$(DOCKER_COMPOSE) kill
$(DOCKER_COMPOSE) down --volumes --remove-orphans

setup: ## Setup spellcheckers dependencies
setup: build
$(DOCKER_COMPOSE) up -d --remove-orphans --no-recreate languagetools

.PHONY: build kill setup

tests: ## Run all tests
tests:
if [ $(WITH_COVERAGE) = true ]; then $(EXEC_PHP) vendor/bin/phpunit --coverage-clover clover.xml; else $(EXEC_PHP) vendor/bin/phpunit; fi

tests-dox: ## Run all tests in dox format
tests-dox:
if [ $(WITH_COVERAGE) = true ]; then $(EXEC_PHP) vendor/bin/phpunit --coverage-clover clover.xml --testdox; else $(EXEC_PHP) vendor/bin/phpunit --testdox; fi

tu: ## Run unit tests
tu: vendor
$(EXEC_PHP) vendor/bin/phpunit --exclude-group integration

ti: ## Run functional tests
ti: vendor
$(EXEC_PHP) vendor/bin/phpunit --group integration

scrutinizer:
$(EXEC_PHP) curl -L https://scrutinizer-ci.com/ocular.phar -o ocular.phar -s
$(EXEC_PHP) php ocular.phar code-coverage:upload --format=php-clover clover.xml

.PHONY: tests tests-dox tu ti

vendor:
if [ $(DEPS) = "LOWEST" ]; then $(COMPOSER) update --prefer-lowest; fi
if [ $(DEPS) = "LOCKED" ]; then $(COMPOSER) install; fi
if [ $(DEPS) = "HIGHEST" ]; then $(COMPOSER) update; else $(COMPOSER) install; fi

rector:
docker run -v $(pwd):/project rector/rector:latest bin/rector process /project/src/ --config vendor/thecodingmachine/safe/rector-migrate.yml --autoload-file /project/vendor/autoload.php

phpcs: vendor
$(EXEC_PHP) vendor/bin/phpcs

phpcbf: vendor
$(EXEC_PHP) vendor/bin/phpcbf

phpstan: vendor
$(EXEC_PHP) vendor/bin/phpstan analyse src -c phpstan.neon -a vendor/autoload.php

.PHONY: vendor php-cs php-cbf php-stan

.DEFAULT_GOAL := help
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
.PHONY: help
Loading

0 comments on commit b73b215

Please sign in to comment.