Skip to content

feat: automatic code style checking #109

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 19 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from 7 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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ vendor/
.idea/

# Environment files
.env/*.*
.env/*.*

# Local configs
.php_cs
.php_cs.cache
phpunit.xml
33 changes: 33 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/lib');

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'binary_operator_spaces' => array(
'align_equals' => false,
'align_double_arrow' => false,
),
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'linebreak_after_opening_tag' => true,
'mb_str_functions' => true,
'no_php4_constructor' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
'concat_space' => ['spacing' => 'one'],
'trailing_comma_in_multiline_array' => true,
'yoda_style' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__ . '/.php_cs.cache');
30 changes: 22 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
language: php
before_script:
- composer install --dev --no-interaction
- cd test/unit

php:
- 5.6
- 7.0

cache:
directories:
- vendor
- $HOME/.composer/cache

install:
- travis_retry composer self-update && composer --version
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- travis_retry composer install --prefer-dist --no-interaction

script:
- ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* --coverage-clover=coverage.xml
- vendor/bin/php-cs-fixer fix --diff --dry-run
- vendor/bin/phpcs -s --config-set ignore_warnings_on_exit 1
- vendor/bin/phpunit --testsuite unit --coverage-clover=coverage.xml

after_success:
- bash <(curl -s https://codecov.io/bash)
php:
- 5.6
- 7.0
- bash <(curl -s https://codecov.io/bash)

env:
global:
- secure: eUN0huKA436uIkISu6V3yW01/gZHC6slBvlnprMPEhzclU2szH6qhWEXWS5CcOG6EEDBReqLZdNAwu+FC69KGFO9+6oW2GQQLSsfEViqFi/Ig2N0r4EBO4jLRebgq0GOfetPwQvJH27d8BCiloPy8rXBb5pskxSNw4B4bRyXHz4=
- secure: j38xzMNmzYXR/JJdVumPmDoDVxb6FUDF497AuVPHowGh0egFW8XHWCOMeQWqWZI4Gg17pViQNIJ3xC6WBvob70AF8fsNm0+vxF2s7abXDMcbq5flLTS6ydKLgNu+na/RAkOBbTwxJAGIH/fQh8BH8iGKerCwoqf8sDErAge4NMw=
- secure: h3HlxBOsNXBDrIJ0yl467ST6Q8R2TmbL7PltlPcRoHy5gAxn5UiDv5W2+6DSXrwQrTjOUunZ+O9ckcaQGQy1JNhGMwgIkJpyWAHDIHhTYGU289uUIDTHQW/soX0qHJSHSx3iMgDOIc7XnfTz6W7Nv1gYKZFedOMsZ5uBMeGyiXE=
- secure: SKSl/RHFQNhGT7OUj7E0AbrQnuDhhCRI/4jC76mmzvy8EJBDgUNevAKJGtug+LVilHrlbk9fLC8rayPW6SGv0s3PowTGm8NMOc48aRBLOr7QRo/sMikJCmRuU6HWptr0NKuf2fq6lV94WDm/pDdyOSNyLga9/eaIDs/Sacp78sw=

notifications:
hipchat:
rooms:
Expand Down
82 changes: 50 additions & 32 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
{
"name": "sendgrid/php-http-client",
"description": "HTTP REST client, simplified for PHP",
"type": "library",
"version": "3.9.6",
"homepage": "http://github.com/sendgrid/php-http-client",
"keywords": ["SendGrid", "HTTP", "REST", "API", "Fluent"],
"license": "MIT",
"authors": [
{
"name": "Matt Bernier",
"email": "[email protected]"
},
{
"name": "Elmer Thomas",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.6"
"name": "sendgrid/php-http-client",
"description": "HTTP REST client, simplified for PHP",
"type": "library",
"version": "3.9.6",
"homepage": "http://github.com/sendgrid/php-http-client",
"keywords": [
"SendGrid",
"HTTP",
"REST",
"API",
"Fluent"
],
"license": "MIT",
"authors": [
{
"name": "Matt Bernier",
"email": "[email protected]"
},
"require-dev": {
"phpunit/phpunit": "~4.4",
"squizlabs/php_codesniffer": "~2.0"
},
"autoload": {
"psr-4": {
"SendGrid\\": "lib/"
}
},
"autoload-dev": {
"psr-4": {
"SendGrid\\Test\\": "test/unit/"
}
{
"name": "Elmer Thomas",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.6",
"ext-json": "*",
"ext-curl": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.8",
"friendsofphp/php-cs-fixer": "~2.10",
"squizlabs/php_codesniffer": "~3.3"
},
"autoload": {
"psr-4": {
"SendGrid\\": "lib/"
}
},
"autoload-dev": {
"psr-4": {
"SendGrid\\Test\\": "test/unit/"
}
},
"scripts": {
"test": "phpunit --testsuite unit",
"php-cs-fix": "php-cs-fixer fix --diff --verbose --config=.php_cs",
"php-cs": "phpcs --standard=PSR1,PSR2 lib"
},
"config": {
"optimize-autoloader": true,
"sort-packages": true
}
}
Loading