-
Notifications
You must be signed in to change notification settings - Fork 736
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
Base PHP-cs-fixer migration to version 2 plus style fix #1555
Base PHP-cs-fixer migration to version 2 plus style fix #1555
Conversation
@massimilianobraglia This is great and it looks like it could still be reviewable as the changes overall are minimal. |
env/elastica/composer.json
Outdated
"sebastian/phpcpd":"~2.0", | ||
"squizlabs/php_codesniffer":"~2.5" | ||
"phpdocumentor/phpdocumentor": "~2.8", | ||
"friendsofphp/php-cs-fixer": "^2.0", |
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.
Could you have a look at CI? I assume some more updates are needed: https://travis-ci.org/ruflin/Elastica/jobs/467233662
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.
Ok! I'll check it ASAP
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 change LGTM as soon as we get CI green. Let me know if I can help here.
Overall the changes are as minimal as I hoped for.
As soon as this PR is in, we should also create a follow up PR to runs the linting on Travis so we can block PR's which do not adhere.
Makefile
Outdated
@@ -140,7 +140,7 @@ gource: | |||
|
|||
## DOCKER IMAGES | |||
|
|||
.PHONY: elastica-image | |||
.PHONY: elastica-image |
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.
Is this change intentional?
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.
No, I didn't notice that 🤔
Fixing..
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.
still needs a fix ;-)
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.
fixed 😄
} else { | ||
return; | ||
} | ||
} |
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.
Nice that it catches such things with return. I'm positively surprised :-)
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.
Yeps! It's such a nice tool (and there are many rules that I have to look deeper 😄)
*/ | ||
public function testToArrayInvalidBucketsPath() | ||
{ | ||
$this->expectException(\Elastica\Exception\InvalidException::class); |
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.
Are the also changes it has done automatically?
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.
Yes, it should be done by using the 'php_unit_dedicate_assert' => ['target' => 'newest'],
rule
test/Elastica/Base.php
Outdated
@@ -7,7 +8,7 @@ | |||
use Elasticsearch\Endpoints\Ingest\Pipeline\Put; | |||
use Psr\Log\LoggerInterface; | |||
|
|||
class Base extends \PHPUnit_Framework_TestCase | |||
class Base extends \PHPUnit\Framework\TestCase |
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.
Automated change?
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.
Yes. Obviously it should be imported with the use
statement
Everything touched by this PR is automated by the CS-fixer. A part from the About the composer problem, it must be a version conflict for |
4fb4606
to
b478559
Compare
yes, seems like it. I wonder if setting it to 2.9 helps? |
b478559
to
4541719
Compare
Unfortunately it does not help. I tried to remove it also and it does not work anyway. Also, I noticed that the CS-Fixer does not support PHP 7.3 (see PHP-CS-Fixer/PHP-CS-Fixer#3697)... |
The good news at least the errors change now. I'm opening #1567 so we can experimenting with updating the other dependencies separately. For php-cs-fixer: When do you expect it to be compatible with PHP 7.3? Is it only a problem with 7.3 if it runs the linter or always? I'm thinking that on travis we should run linting as a separate step and not on all 4 versions. |
@massimilianobraglia I think we need to update composer.json here
it uses "phpunit/phpunit":"~5.6" not sure bad I have a bad smell on that version ;) |
@ruflin the issue I linked is opened since April 2018. I do not know when the full compatibility will be merged. A comment states that the linter is compatible since we do not use one of the new features of PHP 7.3. I agree about not using the linter in every step but in another one. I'm going to rebase and see if the build goes on 😄 |
4541719
to
657da46
Compare
I made it! Let's see what the build on Travis says but the problem about composer's hangin' on was also with the phploc package (see 657da46#diff-bdfe059178421755f0677c4b7b332938L20) I just removed it and it worked! I have also updated PHPUnit version to ^6.0. |
What about using this workaround until PHP-CS-fixer solves the issue with PHP 7.3? |
I assume we don't need a workaround as we just run the linting job with 7.2? Could you rebase this PR on top of master as @p365labs updated the dependency. I hope now the build will run. |
I made it running. The build failed beacuse of PHP-CS-Fixer on PHP 7.3. Rebasing will be done in a moment 😄 |
657da46
to
4f15fb2
Compare
…ted .travis.yml (now checks style
7cb95ff
to
84612d5
Compare
@massimilianobraglia well done ! good point amending .travis + Make 👍 |
That's the point in fact..!
|
env/elastica/composer.json
Outdated
@@ -13,8 +13,6 @@ | |||
], | |||
"require": { | |||
"php": "^7.0", | |||
"phpdocumentor/phpdocumentor": "^2.9", |
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.
Can we please keep this in? I need this to generate the docs :-)
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.
Ok :) Probably I forgot to readd that one.
My thinking for Travis was more that we introduce one more target which could be called Could you readd the removed line to the composer file or does this still cause issue even with the updates? |
It still causes the issue. No problem about adding a separate step with the linting :) |
the new travis.yml file will look something like this: sudo: required
dist: trusty
group: edge
services:
- docker
branches:
only:
- master
env:
global:
- DOCKER_VERSION=17.09.0
- DOCKER_COMPOSE_VERSION=1.17.1
matrix:
- TARGET="70"
- TARGET="71"
- TARGET="72"
- TARGET="73"
- TARGET="Lint"
before_install:
# check running "docker engine" and "docker-compose" version on travis
- docker --version
- docker-compose --version
# list docker-engine versions, usefull to update the docker engine on travis and trusty
# - sudo apt-cache madison docker-engine
# update docker engine to the desired version
- sudo apt-get -o Dpkg::Options::="--force-confnew" install -y docker-ce=${DOCKER_VERSION}~ce-0~ubuntu --allow-downgrades
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
before_script:
- sudo sysctl -w vm.max_map_count=262144
script:
- if [ "$TARGET" != "Lint" ] ; then make tests TARGET=$TARGET ; fi
- if [ "$TARGET" == "Lint" ] ; then make check-style ; fi
after_script:
- cat /var/log/elasticsearch/*.log
- cat /var/log/nginx/*.log
- sudo rm composer.lock && sudo composer require satooshi/php-coveralls dev-master --no-ansi --no-progress --no-interaction
after_success:
- bash <(curl -s https://codecov.io/bash)
- vendor/bin/coveralls -v What do you think about it, @ruflin? |
eb2036b
to
993540d
Compare
993540d
to
41f890e
Compare
@massimilianobraglia LGTM |
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 looks good, we are almost there. Last thing missing I think is a CHANGELOG entry.
What should I enter in the CHANGELOG? |
@massimilianobraglia Changelog SGTM. |
here you are 😄 |
@massimilianobraglia Merged 🎄 Thank you so much for going through all these loops to get this in. Moving forward we should make sure it's as easy as possible for contributors to apply the linting to not get stuck on this step in their PR's. I'm happy to apply more linting rules to Elastica. The less we need to discuss about how things are formatted and the more we can focus on the code itself the better :-) |
Yes!! |
@massimilianobraglia Yes, please. Best do 1 PR per change so we keep it small. |
Hey there!
As stated here #1540, I'm opening multiple CS fix PRs.
This is the base porting from version 1 to version 2 of the linter. Also, I have applied the CS rules in order to show you how this should look like.
@ruflin and @p365labs: what's your opinion about this?