-
-
Notifications
You must be signed in to change notification settings - Fork 342
Update PHP_CodeSniffer #328
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
Codecov Report
@@ Coverage Diff @@
## master #328 +/- ##
==========================================
+ Coverage 98.04% 98.05% +<.01%
==========================================
Files 35 35
Lines 2708 2718 +10
==========================================
+ Hits 2655 2665 +10
Misses 53 53
Continue to review full report at Codecov.
|
@montymxb for future reference if you want to ignore lines for linter
If you want to ignore lines to improve coverage
|
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.
Whew....that's a lot of linted code...Ok, so everything checks out except most of those ignores that should be corrected. If you can take care of that I'll check out those changes and we should be good!
CONTRIBUTING.md
Outdated
@@ -63,7 +63,15 @@ Alternately you can configure a compatible test server as follows: | |||
|
|||
You should now be able to execute the tests, from project root folder: | |||
|
|||
./vendor/bin/phpunit | |||
`npm test` |
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.
Here I would like to retain both ways of running tests in the documentation. In some cases local users may want to use an alternate version of php besides the default to run phpunit under. Via npm test
there's really no way to do this.
You can add it after the npm marks here, since those are a bit more manageable and most will be ready to go that route (I would imagine at least). Something like You may also run tests directly using phpunit as follows
. As for the lint and lint:fix don't worry about adding their equivalents, the npm ones will be fine and are (personally) easier to remember than their equivalents.
CONTRIBUTING.md
Outdated
|
||
Make sure your code is linted with phpcs (PSR-2 Coding Style) | ||
|
||
`npm run lint` |
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.
If you take a look here your code block comment is rendering with the grave ticks still. Same for npm test
above and npm run lint:fix
below.
I like the ability to lint via npm though, this is a lot more concise than calling phpunit directly.
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 catch
CONTRIBUTING.md
Outdated
|
||
You can automatically fix lint errors with phpcbf | ||
|
||
`npm run lint: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.
Same here, nice to have an alias in a sense.
I'm guessing all these changes are from the auto linting? We haven't been enforcing strong linting for some time it would appear. I'll just glance over all these to make sure they're acceptable; I'm expecting they are however.
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.
Yeah auto linting is my friend on this one
src/Parse/ParseClient.php
Outdated
@@ -124,6 +124,7 @@ | |||
* | |||
* @throws Exception | |||
*/ | |||
//@codingStandardsIgnoreLine |
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.
Just curious what was the error phpcs was bringing up here?
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.
Nvm I took a look at it myself. Considering that this line is rather long I would suggest breaking it down like ParseClient::_request
. Then just make sure to remove the ignore above it.
src/Parse/ParseObject.php
Outdated
@@ -807,6 +806,7 @@ public static function destroyAll(array $objects, $useMasterKey = false) | |||
*/ | |||
private static function destroyBatch(array $objects, $useMasterKey = false) | |||
{ | |||
//@codingStandardsIgnoreStart |
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.
Same thing here, you can break down the offending string being set on path
. Looking it you can probably break it down fairly easily like so. Just be sure to remove the ignore start/end once done.
$data[] = [
'method' => 'DELETE',
'path' =>
'/'.ParseClient::getMountPath().
'classes/'.$object->getClassName().
'/'.$object->getObjectId(),
];
src/Parse/ParseUser.php
Outdated
$auth_token, | ||
$auth_token_secret) | ||
{ | ||
$auth_token, //@codingStandardsIgnoreLine |
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 is fine for an ignore, but if you can put it between like so
$consumer_secret = null,
//@codingStandardsIgnoreLine
$auth_token,
it should still work and won't be trailing after $auth_token
instead.
src/Parse/ParseUser.php
Outdated
@@ -246,10 +247,11 @@ public static function loginWithAnonymous() | |||
* @link https://en.wikipedia.org/wiki/Universally_unique_identifier | |||
*/ | |||
$uuid_parts = str_split(md5(mt_rand()), 4); | |||
//@codingStandardsIgnoreStart |
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.
Same, please break the offending line down and remove the ignores.
src/Parse/ParseUser.php
Outdated
@@ -338,10 +342,11 @@ public function linkWithTwitter( | |||
$screen_name, | |||
$consumer_key, | |||
$consumer_secret = null, | |||
$auth_token, | |||
$auth_token, //@codingStandardsIgnoreLine |
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.
Same as the other twitter one, just bump it between the two rather than right after one of the args.
I don't think we'll ever be needing to ignore lines to bump up our coverage, besides I wouldn't really have any desire in artificially inflating that number. According to codecov's report we're already the top dog at just under 98% total coverage as is 👍 . |
Yeah, don't ignore the not-covered lines it makes it impossible to improve correctly the coverage or identifying potential issues. |
@montymxb thanks for the feedback. The changes have been made |
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.
Alright just a couple nit picky things. Everything else looks good to me though. And with the tests looking okay I think we're ready to merge this in once these final changes have been made.
CONTRIBUTING.md
Outdated
|
||
You may also run tests directly using phpunit as follows: | ||
|
||
npm test | ||
|
||
Make sure your code is linted with phpcs (PSR-2 Coding Style) |
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.
I figure just so people aren't wondering about why we would enforce PSR-2 we should make this a link. You can use http://www.php-fig.org/psr/psr-2/, which is the style guide published by the framework interop group.
Making it...
Make sure your code is linted with phpcs (PSR-2 Coding Style)
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.
And if we can add a colon after this statement, same as the line above it:
You may also run tests directly using phpunit as follows:
CONTRIBUTING.md
Outdated
|
||
Make sure your code is linted with phpcs (PSR-2 Coding Style) | ||
|
||
`npm run lint` | ||
npm run lint | ||
|
||
You can automatically fix lint errors with phpcbf |
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.
And if we can add a colon here at the end of this statement too that would be fantastic.
Cool, thanks! Just waiting on one of the CI jobs to rerun real quick. |
* Add lint * update travis * coding style * add coverage to gitignore * removed ignore lines * nit
* Add ParsePolygon Type and polygonContains query * test class fix * error handling for polygon * Update PHP_CodeSniffer (#328) * Add lint * update travis * coding style * add coverage to gitignore * removed ignore lines * nit * Updated parse-php-sdk to version 1.2.9 * Corrects and updates phpdoc references/errors (#329) * Corrects and updates phpdoc references/errors * Lint fixes * Added 'Getting Started' to README.md Adds a **Getting Started** section to README.md to direct newcomers to the [official guide](http://docs.parseplatform.org/php/guide/) and [API reference](http://parseplatform.org/parse-php-sdk/namespaces/Parse.html). * Remove Default API (#332) * Removed default api and added appropriate checking * lint * Pages autodeploy and phpdoc style enforcing (#335) * Added 'document-check' to add phpdoc checking during tests and added deploy for api ref on gh-pages * Wrapping filename in quotes * Moved bash out of package.json * Unescaping strings * Testing missing block comment * Fixing lint exception to expose phpdoc style issue * Restored class summary * removed comment * fix documentation * Pinned jms/serializer to 1.7.1 (#336) * Pinned jms/serializer to 1.7.1 * Checking to update jms/serializer to 1.8.0 ONLY on php 5.4 for travis-ci * Added comment, and added graphviz for class diagrams in generated api docs
I've added a few commands to the package.json file.
npm test
- shortcut for testsnpm run test:coverage
- for travisnpm run lint
- Lints src and test foldersnpm run lint:fix
- Automatically Lints filesI've also forced travis to lint files.
CONTIBUTING.md
has been updatedI have phpcs already installed on my text editor so I thought it would be nice to have in this project.