-
Notifications
You must be signed in to change notification settings - Fork 371
Add style and static analyzer checks #301
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
Conversation
composer.json
Outdated
"phpunit/phpunit": "^5.7" | ||
"phpunit/phpunit": "^5.7", | ||
"friendsofphp/php-cs-fixer": "^2.8", | ||
"phpstan/phpstan": "^0.8.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove from dependencies until 7.0. Require global on CI
30991fc
to
1d018a9
Compare
.phpstan.neon
Outdated
excludes_analyse: | ||
- %rootDir%/vendor/* | ||
ignoreErrors: | ||
- '#Result of method React\\Socket\\ServerInterface::close\(\) \(void\) is used#' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of usage "@" https://github.com/php-pm/php-pm/blob/master/ProcessManager.php#L238
.travis.yml
Outdated
@@ -1,3 +1,4 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ yamllint .travis.yml
1:1 warning missing document start "---" (document-start)
14:81 error line too long (189 > 80 characters) (line-length)
16:81 error line too long (161 > 80 characters) (line-length)
17:81 error line too long (254 > 80 characters) (line-length)
31:81 error line too long (95 > 80 characters) (line-length)
Remove?
.travis.yml
Outdated
- rm composer.lock && rm -rf vendor | ||
- composer install | ||
- ./vendor/bin/phpunit | ||
|
||
# composer can not install httpkernel-adapter with default stability | ||
- composer config minimum-stability dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? We currently are on dev stability?
Client.php
Outdated
@@ -4,8 +4,9 @@ | |||
|
|||
use React\EventLoop\Factory; | |||
use React\EventLoop\LoopInterface; | |||
use React\Socket\UnixConnector; | |||
use React\Promise\ExtendedPromiseInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be PromiseInterface
?
Client.php
Outdated
@@ -27,7 +28,7 @@ public function __construct() | |||
} | |||
|
|||
/** | |||
* @return ConnectionInterface | |||
* @return ExtendedPromiseInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be PromiseInterface
?
I'd suggest getting this in right after #305 which already has a number of clean-ups. |
6a3f886
to
b3f9cba
Compare
b8f72c2
to
5fd8569
Compare
One more note: I have not added phpstan and php-cs-fixer to require-dev section because of php5.6. So, now you should have globally installed phpstan && php-cs-fixer. |
Any feedback? |
Sorry for the troubles. Could you please recheck? I still see the odd |
c7e4d92
to
1e78682
Compare
I've updated PR according to latest refactoring with slaves. Removed ExtendedPromiseInterface, because that part of the code has been removed. |
@dzubchik sorry for the delay- I didn't notice you had pushed once more. I'm happy with all the changes except for the ci updates. It seems we have 3 code analysis tools running now and I'm lost on how to of which one to integrate (and have it hint or fail). Funny enough they also come up with different findings :) I'd propose to merge the code updates but not change the CI pipeline for now? And then lets merge them asap to not get bit-rotten again. |
This is a good reason to keep all of them around! |
And two of them are called "phpstan" 😃 |
@andig PR is updated. Let me know if something should be changed. |
@dzubchik as I wrote- I like the findings but
Could you remove the phpstan config and travis.yml changes? |
@andig , phpstan.neon config can not be removed because it allows to ignore these:
These "errors" appeared because of "@" usage. And the .travis.yml must have these checks otherwise it does not make sense. If we do not run each build this, we should not add these tools at all. And now phpstan and php-code-fixer are not in "require-dev" section because of php5.6. After upgrading we can add them to "composer.json" and developer will have these tools during development. Now, he should install phpstan and php-cs-fixer globally to use them. |
# Static analyzer check | ||
- if [ $TRAVIS_PHP_VERSION = '7.1' ]; then composer require "phpstan/phpstan:^0.9" && ./vendor/bin/phpstan analyze -c .phpstan.neon --level=2 --no-progress src;fi | ||
# Check the code style | ||
- if [ $TRAVIS_PHP_VERSION = '7.1' ]; then IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added to run static analyze checks and code style checks, so code with wrong style-guide, some misspelling, incorrect return types and phpdocs will not be merged to master branch. And it should be run once, not for each php version. The instruction for php-cs-fixer was taken from documentation.
Great, much appreciated and thank you for your patience! |
I've added fixes after analyzer, so please review them. I propose to choose rules from the list.