-
Notifications
You must be signed in to change notification settings - Fork 846
Coding Standards: Add CS Package #15693
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
|
Caution: This PR has changes that must be merged to WordPress.com |
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: June 2, 2020. |
| /* | ||
| * Check to determine if there is a comment immediately preceding the function call. | ||
| */ | ||
| if ( ( $this->tokens[ $previous_comment ]['line'] + 1 ) !== $this->tokens[ $stack_ptr ]['line'] ) { |
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 double-check whether DocBlock association needs to be on the immediate line before, or just the thing before it when whitespace is excluded. i.e.:
/**
* ...
*/
apply_filters( ... );/**
* ...
*/
apply_filters( ... );Both may be correctly associated. It should have parity with the (draft) PSR-5 (my emphasis):
It is RECOMMENDED to precede a "Structural Element" with a DocBlock where it is defined and not with each usage. It is common practice to have the DocBlock precede a Structural Element but it MAY also be separated by an undetermined number of empty lines.
packages/coding-standards/Jetpack/Sniffs/InlineDocs/HooksMustHaveDocblockSniff.php
Outdated
Show resolved
Hide resolved
| <file>.</file> | ||
|
|
||
| <!-- Show sniff codes in all reports --> | ||
| <arg value="s"/> |
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.
Any reason for not including p to show progress?
…ned so we intentionally bump the version there.
GaryJones
left a comment
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.
Requesting a change as the XML is invalid (first inline comment).
|
This PR has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this PR has clear testing instructions, is it up to date with master, and it is still valid. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation. |
When writing up some documentation for a new filter in 8.5, I found a hook docblock that had the incorrect version number (
8.5vs8.5.0) and wanted to prevent that from happening in the future.This is a first pass at a Coding Standards package for Jetpack.
It still needs unit tests and, ideally, PHPCS-compliant docs.
Changes proposed in this Pull Request:
** Verifies that hook execution function calls (
apply_filters,do_action, etc) are preceded by a docblock comment.** Verifies that the docblock comment has a
@sincetag and a@moduletag.I believe there are plenty of places in Jetpack where we don't assign a module to a filter, so that is something we can remove.
The
@sinceenforcement will force a X.Y.Z version while still allow an annotation following it (e.g. both@since X.Y.Zand@since X.Y.Z Changes defaultare allowed).Is this a new feature or does it add/remove features to an existing part of Jetpack?
Testing instructions:
composer installapply_filtersor one of the other hook execution functions. Ensure the tests flag lack of docblock./** This filter is documented in XYZ */style line. Confirm it passes.Proposed changelog entry for your changes: