Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jan 13, 2018
0 parents commit 81bc3a8
Show file tree
Hide file tree
Showing 19 changed files with 3,619 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.php]
indent_size = 4

[*.xml]
indent_size = 4

[Makefile]
indent_style = tab
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.github/ export-ignore
/.travis/ export-ignore
/test/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/.travis.yml export-ignore
/infection.json export-ignore
/Makefile export-ignore
46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at am@localheinz.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
39 changes: 39 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# CONTRIBUTING

We're using [Travis CI](https://travis-ci.org) as a continuous integration system.

For details, see [`.travis.yml`](../.travis.yml).

## Tests

We're using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.

Run

```
$ make test
```

to run all the tests.

## Coding Standards

We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards.

Run

```
$ make cs
```

to automatically fix coding standard violations.

## Extra lazy?

Run

```
$ make
```

to run both coding standards check and tests!
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#### Steps required to reproduce the problem

1.
2.
3.

#### Expected Result

*

#### Actual Result

*
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This PR

* [x]
* [ ]
* [ ]

Follows #.
Related to #.
Fixes #.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
/.php_cs.cache
/infection-log.txt
22 changes: 22 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Localheinz\PhpCsFixer\Config;

$header = <<<EOF
Copyright (c) 2018 Andreas Möller
For the full copyright and license information, please view
the LICENSE file that was distributed with this source code.
@see https://github.com/localheinz/composer-normalize
EOF;

$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php70($header));

$config->getFinder()->in(__DIR__);

$cacheDir = \getenv('TRAVIS') ? \getenv('HOME') . '/.php-cs-fixer' : __DIR__;

$config->setCacheFile($cacheDir . '/.php_cs.cache');

return $config;
134 changes: 134 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
language: php

sudo: false

env:
global:
- secure: "AU7snOmM2KsSplIRIzW5Hj0w6nzxsQPlOeVOJGfaVxsp58U1H426jHCL5+hwPsqNdWyGAlFO0HastoU3oxYHpRUPVTjTCBoMVQIfIcPiWEXERdpPFYuck8JWgTU6iNT9FM+uo0kmNqaqbkTjecIeRTvcXxxP+he29CwHHe7nYNGxOUlMP30xQ1QOylKDH2QyJ57FKYqPWUBvFAzmLnejtx0Ac2A0lULFnmaQuKhYPzEQw/5bBXaiFdLDF/nErCDwYSW8FZMp6yaUnduKW/MCGUSuo/RsIqxMC1XLxwtanmiVlbLgTDquVPivpOCm1sEpnnw/9fsq7Og/dKi7vBjIz2iN9wKUzWutYH9vDaQCp7vw8eNaUqzBhocRAjLmg8vVa3tSR4OZThPKVR4J3lI0KYVTv+JsCvlVNXESt7PXjwHgj0UaR3FUlLmdluY+Rjw81LU+8HUyj243O42gzpgeJPJUNoWiUfutjkaIQomXbMKx3qE8MUDc/hbPXdXlBO0htLX84fjx9RR8pBtJN6wBTUXC1IufZya8O90afnmBlI4zRNG90RpPLcS2tdf82TM5T33HhzyV+8u21ttvEZHPWVtpuaBO1a6nLijciXSnasyqrqiMP0BoeHjCNv00VYlucri+1mC1OL4gZC8J6rS00u+a3xrsmF4Nd/9yqHt6crc="

cache:
directories:
- $HOME/.composer/cache
- $HOME/.php-cs-fixer

stages:
- style
- test

jobs:
include:
- stage: Style

php: 7.0

before_install:
- source .travis/xdebug.sh
- xdebug-disable
- composer validate
- if [[ -n "$GITHUB_TOKEN" ]]; then composer config github-oauth.github.com $GITHUB_TOKEN; fi

install:
- composer install

before_script:
- mkdir -p $HOME/.php-cs-fixer

script:
- vendor/bin/php-cs-fixer fix --config=.php_cs --diff --dry-run --verbose

- &TEST

stage: Test

php: 7.0

env: WITH_LOWEST=true

before_install:
- source .travis/xdebug.sh
- xdebug-disable
- composer validate
- if [[ -n "$GITHUB_TOKEN" ]]; then composer config github-oauth.github.com $GITHUB_TOKEN; fi

install:
- if [[ "$WITH_LOWEST" == "true" ]]; then composer update --prefer-lowest; fi
- if [[ "$WITH_LOCKED" == "true" ]]; then composer install; fi
- if [[ "$WITH_HIGHEST" == "true" ]]; then composer update; fi

script:
- if [[ "$WITH_COVERAGE" == "true" ]]; then xdebug-enable; fi
- if [[ "$WITH_COVERAGE" == "true" ]]; then vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=build/logs/clover.xml; else vendor/bin/phpunit --configuration=test/Unit/phpunit.xml; fi
- if [[ "$WITH_COVERAGE" == "true" ]]; then xdebug-disable; fi

after_success:
- if [[ "$WITH_COVERAGE" == "true" ]]; then bash <(curl -s https://codecov.io/bash); fi

- <<: *TEST

php: 7.0

env: WITH_LOCKED=true

- <<: *TEST

php: 7.0

env: WITH_HIGHEST=true

- <<: *TEST

php: 7.1

env: WITH_LOWEST=true

- <<: *TEST

php: 7.1

env: WITH_LOCKED=true WITH_COVERAGE=true

- <<: *TEST

php: 7.1

env: WITH_HIGHEST=true

- <<: *TEST

php: 7.2

env: WITH_LOWEST=true

- <<: *TEST

php: 7.2

env: WITH_LOCKED=true

- <<: *TEST

php: 7.2

env: WITH_HIGHEST=true

- stage: Infection

php: 7.2

before_install:
- source .travis/xdebug.sh
- xdebug-disable
- composer validate
- if [[ -n "$GITHUB_TOKEN" ]]; then composer config github-oauth.github.com $GITHUB_TOKEN; fi

install:
- composer install

before_script:
- xdebug-enable

script:
- vendor/bin/infection --min-covered-msi=80 --min-msi=80

notifications:
email: false
22 changes: 22 additions & 0 deletions .travis/xdebug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# The problem is that we do not want to remove the configuration file, just disable it for a few tasks, then enable it
#
# For reference, see
#
# - https://docs.travis-ci.com/user/languages/php#Disabling-preinstalled-PHP-extensions
# - https://docs.travis-ci.com/user/languages/php#Custom-PHP-configuration

config="/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"

function xdebug-disable() {
if [[ -f $config ]]; then
mv $config "$config.bak"
fi
}

function xdebug-enable() {
if [[ -f "$config.bak" ]]; then
mv "$config.bak" $config
fi
}
16 changes: 16 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The MIT License (MIT)

Copyright (c) 2018 Andreas Möller

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.
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.PHONY: composer coverage cs infection it test

it: cs test

composer:
composer self-update
composer validate
composer install

coverage: composer
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text

cs: composer
vendor/bin/php-cs-fixer fix --config=.php_cs --diff --verbose

infection:
vendor/bin/infection --min-covered-msi=80 --min-msi=80

test: composer
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# composer-normalize

[![Build Status](https://travis-ci.org/localheinz/composer-normalize.svg?branch=master)](https://travis-ci.org/localheinz/composer-normalize)
[![codecov](https://codecov.io/gh/localheinz/composer-normalize/branch/master/graph/badge.svg)](https://codecov.io/gh/localheinz/composer-normalize)
[![Latest Stable Version](https://poser.pugx.org/localheinz/composer-normalize/v/stable)](https://packagist.org/packages/localheinz/composer-normalize)
[![Total Downloads](https://poser.pugx.org/localheinz/composer-normalize/downloads)](https://packagist.org/packages/localheinz/composer-normalize)

## Installation

Run

```
$ composer global require localheinz/composer-normalize
```

## Contributing

Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).

## Code of Conduct

Please have a look at [`CODE_OF_CONDUCT.md`](.github/CODE_OF_CONDUCT.md).

## License

This package is licensed using the MIT License.
Loading

0 comments on commit 81bc3a8

Please sign in to comment.