Opened 14 years ago
Closed 14 years ago
#14953 closed enhancement (fixed)
Add inline documentation to MultiSite functions
Reported by: | scribu | Owned by: | |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Inline Docs | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Many of the MultiSite specific functions have no inline documentation at all. For example, all those in wp-includes/ms-blogs.php
Attachments (8)
Change History (46)
#4
@
14 years ago
I also found this: http://codex.wordpress.org/WPMU_Functions
#5
@
14 years ago
- Cc andrea_r added
Someone point me to whatever is used to format the inline docs & how-tos. Any guidelines?
#6
@
14 years ago
How's this for a boilerplate template. My comments to the comments are after #.
/** * A one-line description of the function * * A longer description of the plugin. This can span multiple lines. * Also might not be necessary. Lorem ipsum. * Lorem ipsum. * * And multiple paragraphs. * Lorem ipsum. * * @since MU # or 3.0.0 etc. * @access private # if it is an internal function * * @param string $argument_name This argument does blah. * @param array $args This accepts a whole bunch of args: * - blah_id: The id of the blah. Defaults to false, which means no ID is used. * - foo: The foo. Very important. Defaults to an empty string. * @param bool $optional_argument Optional. Default true. This argument does blah. * @return array Returns an array of blah. */ function my_function( $argument_name, $args = array(), $optional_argument = true ) { // Blah }
#7
@
14 years ago
They're phpdoc tags. Here's a tutorial: PHPdoc tutorial
#8
@
14 years ago
- Cc boonebgorges added
I'm working through ms-functions.php and will have a diff in a little while.
#9
@
14 years ago
14953-1.diff is a start on documenting ms-functions.php. Can't do more now, eyeballs are bleeding.
@
14 years ago
Go on then, I'll bite: docs for switch_to_blog (inc beware, see #14992) and restore_current_blog
@
14 years ago
Alternative diff, this time with @uses for all functions called within the documented function, is this best practice to list them exhaustively or only where a comment on usage is required/given?
#13
follow-up:
↓ 16
@
14 years ago
I suggest to put the wordpress version number to @since (Documentation), as @since documents when (at which version) an element was first added to a package.
The file changed in r15675 have the following package phpdocs:
* @package WordPress * @subpackage Multisite
The last commit did use the MU version number (prefixing it with MU) which is needlessly inventing something new on top of PHPDoc and breaks with the documentation standard and with the current doing everywhere else in the project. Everywhere else is with a very few exceptions, a related case where this is problematic is here: #14921.
As we do not need to do documentation work for the past of the MU fork (the MU fork is as much as I know history), I suggest to change the @since tags to @since 3.0.0
to streamline them with the rest of the codebase.
Let me know if you would like to have a patch.
#16
in reply to:
↑ 13
;
follow-up:
↓ 25
@
14 years ago
Replying to hakre:
The last commit did use the MU version number (prefixing it with MU) which is needlessly inventing something new on top of PHPDoc and breaks with the documentation standard and with the current doing everywhere else in the project. Everywhere else is with a very few exceptions, a related case where this is problematic is here: #14921.
As we do not need to do documentation work for the past of the MU fork (the MU fork is as much as I know history), I suggest to change the @since tags to
@since 3.0.0
to streamline them with the rest of the codebase.
Boone went above and beyond in tracking down individual MU versions. By no means is that necessary. However, us using @since MU
originated in 3.0, and I want to continue that pattern. (That's why I haven't committed scribu's patch yet.) This is a special case. I believe it is important for us to differentiate whether MS functions were introduced after the merge, or whether they were a product of the merge.
Simon, patches don't trigger comment notifications, so I'm only seeing your patches now.
Normally there's no need to document every single function via @uses, or even some of them. However, switch_to_blog() and restore_current_blog() need some serious documentation on exactly what they do and what they don't do, ref #14992 and #14941 in particular. We don't need to do little ones like did_action() but for others, it would help to not only include them but to have a description on how said function is used.
#18
@
14 years ago
http://codex.wordpress.org/Inline_Documentation
Columns should break at either 80 or 100 for consistency with the rest of WordPress. Long Descriptions should be Informative paragraphs with concise information related to the technical details and additional information that couldn't be fit in the short description.
However, more or less, one could go through and edit the files for consistency after they are complete.
#19
in reply to:
↑ 17
;
follow-up:
↓ 21
@
14 years ago
Replying to boonebgorges:
14953-2.diff finishes off ms-functions.php.
We should remove all those @uses because:
- they get stale really fast
- you can get that information by using PHPXref or just looking at the source
#21
in reply to:
↑ 19
;
follow-up:
↓ 22
@
14 years ago
Replying to scribu:
We should remove all those @uses because:
- they get stale really fast
- you can get that information by using PHPXref or just looking at the source
As the Codex says, @uses should only be used for globals, like $wpdb.
#22
in reply to:
↑ 21
@
14 years ago
Replying to scribu:
Replying to scribu:
We should remove all those @uses because:
- they get stale really fast
- you can get that information by using PHPXref or just looking at the source
As the Codex says, @uses should only be used for globals, like $wpdb.
The codex does not say that. It also wouldn't be true in any case. The only reason the @uses would be stale is if there were modifications to the code without updating the inline documentation.
Using a separate application takes away from the reasons behind phpdocumentor sites. I would say that only functions that provide more information on the usage of the function should be linked with @uses
as some functions and methods are helpers for other functions.
#23
@
14 years ago
You're right, I misread.
I would say that only functions that provide more information on the usage of the function should be linked with @uses as some functions and methods are helpers for other functions.
Agreed.
#25
in reply to:
↑ 16
@
14 years ago
Replying to nacin:
Boone went above and beyond in tracking down individual MU versions. By no means is that necessary.
and then:
However, us using
@since MU
originated in 3.0, and I want to continue that pattern. (That's why I haven't committed scribu's patch yet.) This is a special case. I believe it is important for us to differentiate whether MS functions were introduced after the merge, or whether they were a product of the merge.
Can you please explain me if it is not necessary to document the MU versions, why you believe those are important? I have problems to understand that.
#28
@
14 years ago
- Type changed from defect (bug) to enhancement
Specifically, still needing dock-blocks are functions in ms-functions.php after around line 500.
#30
@
14 years ago
- Keywords 3.2-early added
- Milestone changed from 3.1 to Future Release
Beta. Punting. Marking 3.2-early.
#31
in reply to:
↑ 17
@
14 years ago
- Keywords has-patch added; needs-patch removed
Replying to boonebgorges:
14953-2.diff finishes off ms-functions.php.
Looks like this never got committed.
#33
@
14 years ago
I've updated the patch from boonebgorges for the current trunk. Should also @uses
entries be removed, like scribu suggested? Or should they be revised to include only the most important ones?
#34
@
14 years ago
Common and utility functions can be removed. Some are certainly useful to reference.
#36
@
14 years ago
Can this go into 3.1 before it needs refreshing again? :) No functionality changes here anyway.
Any patch in sight? September is closing ...