-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add CONTRIBUTING file and pre_commit hook
- Loading branch information
James G Silva
committed
Feb 15, 2021
1 parent
7fd5da9
commit 4c9ec2d
Showing
13 changed files
with
191 additions
and
113 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ composer.phar | |
/vendor/ | ||
.idea | ||
.phpunit.result.cache | ||
.php_cs.cache | ||
.php_cs | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->files() | ||
->name('*.php') | ||
->exclude('Fixtures') | ||
->in(__DIR__.'/src') | ||
->in(__DIR__.'/tests') | ||
; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setUsingCache(true) | ||
->setRiskyAllowed(true) | ||
->setRules(array( | ||
'@PSR2' => true, | ||
// some rules disabled as long as 1.x branch is maintained | ||
'binary_operator_spaces' => array( | ||
'default' => null, | ||
), | ||
'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'return', 'throw', 'try']], | ||
'cast_spaces' => ['space' => 'single'], | ||
'include' => true, | ||
'class_attributes_separation' => ['elements' => ['method']], | ||
'no_blank_lines_after_class_opening' => false, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'no_empty_statement' => true, | ||
'no_extra_consecutive_blank_lines' => true, | ||
'no_leading_import_slash' => true, | ||
'no_leading_namespace_whitespace' => true, | ||
'no_trailing_comma_in_singleline_array' => true, | ||
'no_unused_imports' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'object_operator_without_whitespace' => true, | ||
'phpdoc_align' => true, | ||
'phpdoc_indent' => true, | ||
'phpdoc_no_access' => true, | ||
'phpdoc_no_package' => true, | ||
'phpdoc_order' => true, | ||
//'phpdoc_scalar' => true, | ||
'phpdoc_trim' => true, | ||
//'phpdoc_types' => true, | ||
'psr0' => true, | ||
//'array_syntax' => array('syntax' => 'short'), | ||
'declare_strict_types' => true, | ||
'single_blank_line_before_namespace' => true, | ||
'standardize_not_equals' => true, | ||
'ternary_operator_spaces' => true, | ||
'trailing_comma_in_multiline_array' => true, | ||
)) | ||
->setFinder($finder) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Contributing | ||
|
||
Thank you for your interest in contributing to our `monolog-kinesis-handler`! | ||
|
||
## Before submitting a pull request | ||
|
||
- Add git hooks running `cp docs/hooks/pre-commit .git/hooks` | ||
- Check Coding Standards running `composer run-script cs-check` | ||
- Fix Coding Standards running `composer run-script cs-fix` | ||
- Statically analysis running `composer run-script phpstan` | ||
- Detects coding standards violations running `composer run-script phpcs` | ||
- Test running `composer run-script test` | ||
|
||
## Submitting a pull request | ||
|
||
1. [Fork](https://github.com/jamesgsilva/monolog-kinesis-handler/fork) and clone the repository; | ||
1. Create a new branch: `git checkout -b my-branch-name`; | ||
1. Make your change, push to your fork and [submit a pull request](https://github.com/jamesgsilva/monolog-kinesis-handler/compare); | ||
1. Pat your self on the back and wait for your pull request to be reviewed. | ||
|
||
## Resources | ||
|
||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) | ||
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) | ||
- [GitHub Help](https://help.github.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use Aws\Kinesis\KinesisClient; | ||
|
||
$kineses = new KinesisClient([ | ||
'endpoint' => 'http://localhost:4567', | ||
'region' => 'us-west-2', | ||
'version' => 'latest', | ||
'credentials' => [ | ||
'key' => 'YOUR_AWS_ACCESS_KEY_ID', | ||
'secret' => 'YOUR_AWS_SECRET_ACCESS_KEY', | ||
], | ||
'retries' => 10, | ||
'delay' => 1000, | ||
'synchronous' => true, | ||
'http' => [ | ||
'timeout' => 5, | ||
'connect_timeout' => 5, | ||
'verify' => false | ||
] | ||
]); | ||
|
||
return $kineses; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use Aws\Kinesis\KinesisClient; | ||
use Monolog\Logger; | ||
use JamesGSilva\MonologKinesisHandler\KinesisHandler; | ||
|
||
/** @var KinesisClient $kinesis */ | ||
$kinesis = require 'kinesis.php'; | ||
$shardCount = 2; | ||
$streamName = 'my_stream_name'; | ||
$kinesis->createStream([ | ||
'ShardCount' => $shardCount, | ||
'StreamName' => $streamName, | ||
]); | ||
$kinesisHandler = new KinesisHandler($kinesis, $streamName); | ||
$logger = new Logger('logs'); | ||
$logger->pushHandler($kinesisHandler); | ||
$logger->info('Hello Kinesis'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
echo 'Run PHPCSFixer ' . PHP_EOL; | ||
exec('composer run-script cs-check', $output, $returnCode); | ||
if ($returnCode !== 0) { | ||
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL; | ||
echo 'Aborting commit by cs-check. Fix with composer cs-fix' . PHP_EOL; | ||
exit(1); | ||
} | ||
echo $output[1] . PHP_EOL; | ||
|
||
echo 'Run PHPCS ' . PHP_EOL; | ||
exec('composer run-script phpcs', $output, $returnCode); | ||
if ($returnCode !== 0) { | ||
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL; | ||
echo 'Aborting commit by phpcs' . PHP_EOL; | ||
exit(1); | ||
} | ||
echo $output[2] . PHP_EOL; | ||
|
||
echo 'Run PHPStan ' . PHP_EOL; | ||
exec('composer run-script phpstan', $output, $returnCode); | ||
if ($returnCode !== 0) { | ||
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL; | ||
echo 'Aborting commit by phpstan' . PHP_EOL; | ||
exit(1); | ||
} | ||
echo $output[8] . ' - ' . $output[2] . PHP_EOL; | ||
|
||
echo 'Run PHPUnit ' . PHP_EOL; | ||
exec('composer run-script test', $output, $returnCode); | ||
if ($returnCode !== 0) { | ||
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL; | ||
echo 'Aborting commit by tests' . PHP_EOL; | ||
exit(1); | ||
} | ||
echo array_pop($output) . PHP_EOL; | ||
|
||
exit(0); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters