Skip to content

Commit b73b215

Browse files
committed
init commit
0 parents  commit b73b215

File tree

91 files changed

+4560
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4560
-0
lines changed

.editorconfig

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
max_line_length = 80
17+
18+
[Makefile]
19+
indent_style=tab
20+
21+
[*.yml]
22+
indent_size = 2

.gitattributes

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis export-ignore
8+
/.github export-ignore
9+
/.travis.yml export-ignore
10+
/.editorconfig export-ignore
11+
/phpunit.xml.dist export-ignore
12+
/.scrutinizer.yml export-ignore
13+
/tests export-ignore
14+
/docs export-ignore
15+
/docker export-ignore
16+
/docker-compose.yml export-ignore
17+
/Makefile export-ignore
18+
/phpstan.neon export-ignore

.github/CONTRIBUTING.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
We accept contributions via Pull Requests on [Github](https://github.com/tigitz/php-spellcheck).
6+
7+
8+
## Pull Requests
9+
10+
- **Coding Standard** - Check the code style with ``vendor/bin/phpcs``.
11+
12+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
13+
14+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
15+
16+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
17+
18+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

.github/ISSUE_TEMPLATE.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!-- Provide a general summary of the issue in the Title above -->
2+
3+
## Detailed description
4+
5+
Provide a detailed description of the change or addition you are proposing.
6+
7+
Tag the issue with it's proper type
8+
9+
## Context
10+
11+
Why is this change important to you? How would you use it?
12+
13+
How can it benefit other users?
14+
15+
## Possible implementation
16+
17+
Not obligatory, but suggest an idea for implementing addition or change.
18+
19+
## Your environment
20+
21+
Include as many relevant details about the environment you experienced the bug in and how to reproduce it.
22+
23+
* Version used (e.g. PHP 5.6, HHVM 3):
24+
* Operating system and version (e.g. Ubuntu 16.04, Windows 7):
25+
* Link to your project:
26+
* ...
27+
* ...

.github/PULL_REQUEST_TEMPLATE.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
## Description
4+
5+
Describe your changes in detail.
6+
7+
## Motivation and context
8+
9+
Why is this change required? What problem does it solve?
10+
11+
If it fixes an open issue, please link to the issue here (if you write `fixes #num`
12+
or `closes #num`, the issue will be automatically closed when the pull is accepted.)
13+
14+
## How has this been tested?
15+
16+
Please describe in detail how you tested your changes.
17+
18+
Include details of your testing environment, and the tests you ran to
19+
see how your change affects other areas of the code, etc.
20+
21+
## Screenshots (if appropriate)
22+
23+
## Checklist:
24+
25+
Go over all the following points before making your PR:
26+
27+
- [ ] I have read the **[CONTRIBUTING](CONTRIBUTING.md)** document.
28+
- [ ] My pull request addresses exactly one patch/feature.
29+
- [ ] I have created a branch for this patch/feature.
30+
- [ ] I have added tests to cover my changes.
31+
- [ ] If my change requires a change to the documentation, I have updated it accordingly.
32+
33+
If you're unsure about any of these, don't hesitate to ask. We're here to help!

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build
2+
composer.lock
3+
vendor
4+
.idea
5+
.phpcs-cache

.scrutinizer.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
build:
2+
nodes:
3+
analysis:
4+
environment:
5+
php:
6+
version: 7.2
7+
cache:
8+
disabled: false
9+
directories:
10+
- ~/.composer/cache
11+
project_setup:
12+
override: true
13+
tests:
14+
override:
15+
- php-scrutinizer-run
16+
dependencies:
17+
override:
18+
- composer install --no-interaction --prefer-dist
19+
20+
tools:
21+
external_code_coverage:
22+
timeout: 3600
23+
24+
filter:
25+
excluded_paths:
26+
- docs
27+
28+
build_failure_conditions:
29+
- 'elements.rating(<= B).new.exists' # No new classes/methods with a rating of B or worse allowed
30+
- 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity
31+
- 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection

.travis.yml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# This triggers builds to run on the new TravisCI infrastructure.
2+
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
3+
sudo: false
4+
5+
language: minimal
6+
7+
services:
8+
- docker
9+
10+
stages:
11+
- Smoke Testing
12+
- Test
13+
14+
## Cache composer
15+
cache:
16+
directories:
17+
- vendor
18+
- $HOME/.composer/cache
19+
- $HOME/docker
20+
21+
jobs:
22+
include:
23+
- &BASE_JOB
24+
stage: Test
25+
install:
26+
- sudo service docker stop
27+
- if [ "$(ls -A /home/travis/docker)" ]; then echo "/home/travis/docker already set"; else sudo mv /var/lib/docker /home/travis/docker; fi
28+
- 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"
29+
- sudo service docker start
30+
- make setup
31+
- make vendor
32+
env:
33+
- DEPS=HIGHEST
34+
- PHP_VERSION=7.3
35+
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
36+
script:
37+
- make tests
38+
after_success:
39+
- if [[ "$WITH_COVERAGE" == true ]]; then bash <(curl -s https://codecov.io/bash); fi
40+
- |
41+
if [[ "PHP_VERSION" == '7.2' && "$WITH_COVERAGE" == true ]]; then
42+
make scrutinizer
43+
fi
44+
before_cache:
45+
- sudo service docker stop
46+
- sudo chown -R travis ~/docker
47+
48+
- <<: *BASE_JOB
49+
env:
50+
- DEPS=LOWEST
51+
- PHP_VERSION=7.3
52+
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
53+
54+
- <<: *BASE_JOB
55+
env:
56+
- DEPS=HIGHEST
57+
- PHP_VERSION=7.2
58+
- WITH_COVERAGE=true
59+
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
60+
61+
- <<: *BASE_JOB
62+
env:
63+
- DEPS=LOWEST
64+
- PHP_VERSION=7.2
65+
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
66+
67+
- <<: *BASE_JOB
68+
env:
69+
- DEPS=HIGHEST
70+
- PHP_VERSION=7.1
71+
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
72+
73+
- <<: *BASE_JOB
74+
env:
75+
- DEPS=LOWEST
76+
- PHP_VERSION=7.1
77+
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
78+
79+
- <<: *BASE_JOB
80+
stage: Smoke Testing
81+
env:
82+
- PHPSTAN
83+
- DEPS=HIGHEST
84+
- PHP_VERSION=7.3
85+
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
86+
script:
87+
- make phpstan
88+
89+
- <<: *BASE_JOB
90+
stage: Smoke Testing
91+
env:
92+
- PHPCS
93+
- DEPS=HIGHEST
94+
- PHP_VERSION=7.3
95+
- DOCKER_COMPOSE=docker-compose -f docker-compose.yml -f .travis/docker-compose.ci.yml
96+
script:
97+
- make phpcs

.travis/docker-compose.ci.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3.2'
2+
3+
services:
4+
php7.1:
5+
volumes:
6+
- $HOME/.composer/cache:/root/composer/cache
7+
environment:
8+
- COMPOSER_CACHE_DIR=/root/composer/cache
9+
10+
php7.2:
11+
volumes:
12+
- $HOME/.composer/cache:/root/composer/cache
13+
environment:
14+
- COMPOSER_CACHE_DIR=/root/composer/cache
15+
16+
php7.3:
17+
volumes:
18+
- $HOME/.composer/cache:/root/composer/cache
19+
environment:
20+
- COMPOSER_CACHE_DIR=/root/composer/cache

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2018 PhpSpellCheck Project
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
13+
> all 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
21+
> THE SOFTWARE.

Makefile

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
DOCKER_COMPOSE ?= docker-compose
2+
EXEC_PHP = $(DOCKER_COMPOSE) run --rm -T php$(PHP_VERSION)
3+
PHP_VERSION ?= 7.3
4+
DEPS ?= "LOCKED"
5+
COMPOSER = $(EXEC_PHP) composer
6+
WITH_COVERAGE ?= "FALSE"
7+
8+
build:
9+
@$(DOCKER_COMPOSE) pull --parallel --ignore-pull-failures 2> /dev/null
10+
$(DOCKER_COMPOSE) build php$(PHP_VERSION)
11+
12+
kill:
13+
$(DOCKER_COMPOSE) kill
14+
$(DOCKER_COMPOSE) down --volumes --remove-orphans
15+
16+
setup: ## Setup spellcheckers dependencies
17+
setup: build
18+
$(DOCKER_COMPOSE) up -d --remove-orphans --no-recreate languagetools
19+
20+
.PHONY: build kill setup
21+
22+
tests: ## Run all tests
23+
tests:
24+
if [ $(WITH_COVERAGE) = true ]; then $(EXEC_PHP) vendor/bin/phpunit --coverage-clover clover.xml; else $(EXEC_PHP) vendor/bin/phpunit; fi
25+
26+
tests-dox: ## Run all tests in dox format
27+
tests-dox:
28+
if [ $(WITH_COVERAGE) = true ]; then $(EXEC_PHP) vendor/bin/phpunit --coverage-clover clover.xml --testdox; else $(EXEC_PHP) vendor/bin/phpunit --testdox; fi
29+
30+
tu: ## Run unit tests
31+
tu: vendor
32+
$(EXEC_PHP) vendor/bin/phpunit --exclude-group integration
33+
34+
ti: ## Run functional tests
35+
ti: vendor
36+
$(EXEC_PHP) vendor/bin/phpunit --group integration
37+
38+
scrutinizer:
39+
$(EXEC_PHP) curl -L https://scrutinizer-ci.com/ocular.phar -o ocular.phar -s
40+
$(EXEC_PHP) php ocular.phar code-coverage:upload --format=php-clover clover.xml
41+
42+
.PHONY: tests tests-dox tu ti
43+
44+
vendor:
45+
if [ $(DEPS) = "LOWEST" ]; then $(COMPOSER) update --prefer-lowest; fi
46+
if [ $(DEPS) = "LOCKED" ]; then $(COMPOSER) install; fi
47+
if [ $(DEPS) = "HIGHEST" ]; then $(COMPOSER) update; else $(COMPOSER) install; fi
48+
49+
rector:
50+
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
51+
52+
phpcs: vendor
53+
$(EXEC_PHP) vendor/bin/phpcs
54+
55+
phpcbf: vendor
56+
$(EXEC_PHP) vendor/bin/phpcbf
57+
58+
phpstan: vendor
59+
$(EXEC_PHP) vendor/bin/phpstan analyse src -c phpstan.neon -a vendor/autoload.php
60+
61+
.PHONY: vendor php-cs php-cbf php-stan
62+
63+
.DEFAULT_GOAL := help
64+
help:
65+
@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/'
66+
.PHONY: help

0 commit comments

Comments
 (0)