-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
Streamline WPCS in file documentation. #651
Conversation
@@ -51,8 +53,9 @@ | |||
* Documented here for clarity. Not (re)defined as it is already defined in the parent class. | |||
* | |||
* @return array | |||
* | |||
abstract public function getGroups(); |
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.
Something wrong 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.
What do you mean ?
"Not (re)defined as it is already defined in the parent class."
Comments style wise if I close the doc block and use a //
comment, I get a notice that inline comments need a blank line before them, so this way, the abstract method is still documented in the child abstract class and passes the doc checks.
There may be better ways to do this, but I couldn't think of any. Advice welcome ;-)
I think the
Since every |
I'm not sure about including the |
Anyone else for just removing all |
I've all for removing I would say to keep
|
I'll agree with @GaryJones to keep the |
Does anybody else have thoughts on this? I always include |
I include them from day one too. If we ever run WPParser / phpDocumentor / APIGen or similar tool, then having the method have explicit |
Thanks for having a look at this. Regarding the Calling it
As the Regarding the Regarding the Regarding the If anyone wants to add them to all methods/properties, feel free, but I honestly don't think it's necessary. At the very least it'll be easier now as I've already done the research of when things were added. |
Follow the standard as described in https://www.phpdoc.org/docs/latest/references/phpdoc/tags/package.html The @category tag is considered deprecated. A hierarchical @Package tag should be used instead. Ref: https://www.phpdoc.org/docs/latest/references/phpdoc/tags/category.html
Capitalization, punctuation and some spelling.
…ght type hint. But only if it doesn't conflict with upstream function signatures.
Based on Git file history: * Add @SInCE tags to all classes. * Add @SInCE tags to properties and methods if they weren't included from the start. * Verify/Fix a number of @author tags. * Remove old/copied over/incorrect PHPCS tags. * Where necessary improved/corrected the class description. Also: * Consistent tag order in class doc blocks. * Fix tag alignment. * Remove redundant explanation in unit test class doc blocks. * Sync the description line of the unit test class doc blocks.
Includes information on when the sniff was last synced with the upstream sniff if applicable and available.
… doc blocks. License tag as per https://www.phpdoc.org/docs/latest/references/phpdoc/tags/license.html
26fffa2
to
1e7e2a5
Compare
(Rebased for merge conflict) |
I disagree that v3 of PHPCS doesn't have
By that logic, every WP plugin should therefore be given a Until such time as WPCS is included as a standard inside the PHPCS package, then it doesn't make sense to claim to be a sub-part of their package, just because it's currently our only dependency. The composer package that can be grabbed from this repo, is independently authored, so our top level vendor and package name would be
Although it seems like a logical approach, I see no recommendation for that in the PSR-5 draft or remember seeing it in previous suggestions. |
As PHPCS is still distributed through PEAR as well, their namespace is determined by that. Also:
Ref: https://www.phpdoc.org/docs/latest/references/phpdoc/tags/package.html
Actually, yes, I think that would make a lot of sense to do. |
I agree, I've never interpreted it this way. And take a look at what it says in the WordPress inline docs standards:
|
Not so much worried about that, though it would be ideal (IMHO). I was just seeing you removing some, and that's what tipped me off. Let's at least not do that. |
Yeah, well, WP has kind of a habit of fool hardy doing the opposite of what the wider PHP community agrees upon, so that doesn't surprise me.... To be honest, it sounds more like a brand protection line coming from Automattic than any attempt to comply with real standards. |
I don't mind reverting that bit. When I was working on it, I chose to let consistency prevail rather than have small exceptions littered all over the place. |
I've added two new commits based on the feedback which contain the following changes:
Still not sure about the |
Grrr... removing the @Package tag at the file level actually broke the build as it's part of the doc standard to have one... so... what shall we do now ? |
As I said:
|
@GaryJones That's neither here nor there. I didn't (yet) change the package tag, just removed it from the file level doc block as that |
@jrfnl so you could re-add the
I would strongly advise against this, as we should make sure your volume of work is reflected in the contributor graphs 😄 We should then merge this large PR and do some testing with it in |
@westonruter Any opinion on what the
Please do squash the commits. I really think this should be one commit as it addresses one issue and would otherwise make the history a lot less easy to navigate. |
@jrfnl seems that |
b6b6d24
to
855736f
Compare
Updated the
As the PR does not contain any code/functional changes, I don't think much - if any - testing is necessary. |
FYI - I've made a start at creating a changelog will push it later today so others can contribute to it as well. |
@jrfnl you are amazing. 🙌 |
@westonruter 😎 Might as well try to get 0.10.0 out of the door now. We're two weeks past the self-set deadline already. |
FYI: All - I've rebased all my other open PRs to fix any merge conflicts with this one. |
* Update the file and class @Package tag and remove the @category tag. Follow the standard as described in https://www.phpdoc.org/docs/latest/references/phpdoc/tags/package.html The @category tag is considered deprecated. A hierarchical @Package tag should be used instead. Ref: https://www.phpdoc.org/docs/latest/references/phpdoc/tags/category.html * Use correct version number for the newly deprecated classes. * Fix some - unintentional - parse errors in the test files. * Attempt to lead by example comment-wise in the unit tests. Capitalization, punctuation and some spelling. * Proper capitalization and punctuation for class end comments. * Remove `//end` comments for methods and conditionals < 35 lines. * Simplify the test file method doc blocks. * Various documentation fixes, largely based on PHPCS Docs output. * Make sure any function which will be passed the $phpcsFile has the right type hint. But only if it doesn't conflict with upstream function signatures. * Verify and update the docblocks for all files and classes. Based on Git file history: * Add @SInCE tags to all classes. * Add @SInCE tags to properties and methods if they weren't included from the start. * Verify/Fix a number of @author tags. * Remove old/copied over/incorrect PHPCS tags. * Where necessary improved/corrected the class description. Also: * Consistent tag order in class doc blocks. * Fix tag alignment. * Remove redundant explanation in unit test class doc blocks. * Sync the description line of the unit test class doc blocks. * Add handbook links to a number of sniffs. * Add reference to upstream sniff a sniff is based upon. Includes information on when the sniff was last synced with the upstream sniff if applicable and available. * Add @license tag and @link tag to the WPCS GH repo, to all file level doc blocks. License tag as per https://www.phpdoc.org/docs/latest/references/phpdoc/tags/license.html * Add the docs ruleset to the coding standard for WPCS itself. * Add @SInCE class changelogs for PR #647. * Fix minor grammar error. * Updated `@since` tags for `2014-12-11` release to `0.3.0`. * Re-instate previously removed @SInCE tags. * Updated based on feedback. * Adjusted the @Package tags as per discussion in the PR thread * Removed the @link tag to the handbook at the file level doc block * Removed the @author tags
* Update the file and class @Package tag and remove the @category tag. Follow the standard as described in https://www.phpdoc.org/docs/latest/references/phpdoc/tags/package.html The @category tag is considered deprecated. A hierarchical @Package tag should be used instead. Ref: https://www.phpdoc.org/docs/latest/references/phpdoc/tags/category.html * Use correct version number for the newly deprecated classes. * Fix some - unintentional - parse errors in the test files. * Attempt to lead by example comment-wise in the unit tests. Capitalization, punctuation and some spelling. * Proper capitalization and punctuation for class end comments. * Remove `//end` comments for methods and conditionals < 35 lines. * Simplify the test file method doc blocks. * Various documentation fixes, largely based on PHPCS Docs output. * Make sure any function which will be passed the $phpcsFile has the right type hint. But only if it doesn't conflict with upstream function signatures. * Verify and update the docblocks for all files and classes. Based on Git file history: * Add @SInCE tags to all classes. * Add @SInCE tags to properties and methods if they weren't included from the start. * Verify/Fix a number of @author tags. * Remove old/copied over/incorrect PHPCS tags. * Where necessary improved/corrected the class description. Also: * Consistent tag order in class doc blocks. * Fix tag alignment. * Remove redundant explanation in unit test class doc blocks. * Sync the description line of the unit test class doc blocks. * Add handbook links to a number of sniffs. * Add reference to upstream sniff a sniff is based upon. Includes information on when the sniff was last synced with the upstream sniff if applicable and available. * Add @license tag and @link tag to the WPCS GH repo, to all file level doc blocks. License tag as per https://www.phpdoc.org/docs/latest/references/phpdoc/tags/license.html * Add the docs ruleset to the coding standard for WPCS itself. * Add @SInCE class changelogs for PR #647. * Fix minor grammar error. * Updated `@since` tags for `2014-12-11` release to `0.3.0`. * Re-instate previously removed @SInCE tags. * Updated based on feedback. * Adjusted the @Package tags as per discussion in the PR thread * Removed the @link tag to the handbook at the file level doc block * Removed the @author tags
Ok, so this is another quite big one, though it does not contain any pertinent functional changes.
This PR lets the WPCS code base pass the
docs
sniffs as currently defined.Additionally, I've tried to make the docs more consistent and removed outdated tags and redundancy.
Overview of changes:
Functional:
.inc
test files.File and class doc blocks:
@category
tags as per the recommendation in https://www.phpdoc.org/docs/latest/references/phpdoc/tags/category.html@package
tags to reflect a logical hierarchy as per the recommendation in https://www.phpdoc.org/docs/latest/references/phpdoc/tags/package.html@license
tags to all file level doc blocks as per the recommendation in https://www.phpdoc.org/docs/latest/references/phpdoc/tags/license.html@since
tags to all class level doc blocks based on Git history of the classes. The version mentioned in the@since
tag is based on the name of the first released WPCS version in which the class was contained as per https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases. For classes which have been in WPCS since it got taken over from John Godley, I've used tag0.1
.@since
tag to document the changes as per the WP core doc standard.@author
tags and added/corrected some where needed. Removed additional@author
tags as per the currentdocs
standard only one@author
tag allowed per doc block.@see
tags to any deprecated classes as per WP doc standard.Property, method and inline documentation:
@since
tags for methods and properties which were part of the class at the point of first release.@since
tags to these methods and properties.@return
tag info.Test files good/bad documentation:
.inc
test files (lead by example).General:
The file level doc blocks are now the same everywhere. I realize that is not how it's supposed to be, but they don't really add much value anyway when the class doc blocks are good (which they should be now) and at the very least, the file doc blocks are now consistent instead of a mish-mash of copied over info.
Feedback welcome.
I strongly advise for the commits be squashed when merging this, they are just there to show the different iterations and to make reviewing of the changes easier.
P.S.: this PR includes all the necessary
@since
tags for the 0.10.0 release 😎