Closed (fixed)
Project:
Skinr
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
29 Oct 2010 at 16:34 UTC
Updated:
29 Dec 2010 at 19:20 UTC
Jump to comment: Most recent file
Not all functions are properly documented. Let's try and fix up as much as we can to allow for easier understanding of Skinr's code.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | skinr_957070_6.patch | 59.66 KB | moonray |
| #4 | 957070-4.patch | 56.12 KB | jacine |
| #2 | skinr_957070_2.patch | 55.66 KB | moonray |
| #1 | skinr_957070.patch | 4.45 KB | moonray |
Comments
Comment #1
moonray commentedHere's a first pass. If someone wants to keep on fixing code documentation in the same vein, it would be very helpful.
Comment #2
moonray commentedAll code is now properly documented.
Comment #4
jacineHere's a re-roll. The patch failed to apply because of a recent commit: #960548: Remove support for template files. The template hunks have been removed in this patch.
Comment #5
sunThanks! Most of this patch makes sense. A few details:
(and elsewhere) Only to be updated if we really insist, but definitely to keep in mind for future patches:
1) No quotes around list labels/keys in phpDoc, see http://drupal.org/node/1354 for details.
2) List item description should start capitalized; i.e., with an upper-case letter.
OT for this patch, but still worth mentioning:
If the parameters of a function need such a description and are effectively different depending on another parameter, then this is a clear sign that a function is overloaded.
In this case, however, $form and $form_state always seem to be what $form and $form_state always are: $form and $form_state. Thus, those @param descriptions are a bit weird. :)
(and elsewhere)
1) phpDoc summaries do not wrap at 80 chars, see http://drupal.org/node/1354 for details.
2) "JS" and "CSS" are common acronyms, always upper-case.
3) Source code comments should never refer to "we", because "we" is ambiguous in many ways: a) The function caller b) The function itself c) The Skinr module d) The Skinr developers e) The author of a skin f) ... There is only one exception for valid usage of "we": Dirty hacks. In certain edge-cases, dirty hacks are the only way to get something done in Drupal, and only in those cases, it is valid to state that "we" (the module authors) are purposively hacking around a bad-ass limitation of Drupal.
Elsewhere in Drupal, $sids refers to session IDs, but I doubt that we are dealing with user sessions here. However, this @param description only states "ID" without stating what kind of ID is being meant.
If the $sids parameter is also used by other functions, then it would be good to write a standardized @param description that is consistently stated by all of those functions.
Typo in "fuction".
Never leave stale trailing blank phpDoc lines.
1) It's odd that the only (and normally required) argument of a (single) loader function is declared as optional, defaulting to NULL.
2) If this argument default value is intended for any reason, then the @param description should start with "(optional) ". See http://drupal.org/node/1354 for details and examples.
1) Typo in "Determin".
2) Simple 1/0 helper functions like this don't need extensive phpDoc. @param and @return can be summarized in the phpDoc summary, like this:
"Returns whether a rule applies to the current page."
3) OT for this patch: Helper functions like this should be named module_foo_IS_bar(); i.e., skinr_rule_is_visible().
err, what? LOL! :)
I thought "skinsets" would be a term of the past?
Looks like we forgot to remove yet another function...?
Thanks for clarifying all of those parameters! Definitely helpful for rewriting (which badly needs to happen for this function).
(and elsewhere) Trailing white-space.
phpDoc summary for form validation handlers should be:
"Form validation handler for foo_bar_form()."
(same applies to submit handlers, just replace "validation" with "submit")
(possibly elsewhere) Typo in "Implementats".
If a @todo exceeds 80 chars, indent following lines with 2 spaces. See http://drupal.org/node/1354 for details and examples.
Powered by Dreditor.
Comment #6
moonray commentedThanks for the exhaustive review, sun. Most of the comments were addressed. Below are a few that required clarification or additional comments:
• Regarding "1) It's odd that the only (and normally required) argument of a (single) loader function is declared as optional, defaulting to NULL.". See node_load(). The function is based on that (which also has an optional $nid argument).
• Regarding "I thought "skinsets" would be a term of the past?". Yes they will be, but this function is from the old system (and will most likely be removed in future patches). I was documenting as much as possible so that other people can more easily write those patches.
• Re "Looks like we forgot to remove yet another function...?" Again, another function that will most likely be removed in subsequent patching.
Comment #8
moonray commented#6: skinr_957070_6.patch queued for re-testing.
Comment #10
moonray commented(test bot seems to have issues)
Comment #11
jacineI just spent the last couple of hours looking through the code with this patch applied. I made a few minor spelling and coding style fixes and decided to commit this, because it is an improvement and doesn't need to sit here and hold everything else up while it gets worked on.
http://drupal.org/cvs?commit=453738
With regard to this:
I think the code still has a long way to go, from where I sit, to understand what's going on and to be able to write patches. I think the work on getting the terminology right will help, but the thing that would really help me is documenting what's going on inside the functions themselves. There is not enough of that going on.
In addition, I found quite a few functions don't have undocumented parameters or returns. It's inconsistent so I cannot figure out if there is a pattern I'm missing or this was done for a reason or not, so I'm leaving this marked as needs work.
Comment #12
jacineI guess this is going to be done as we go along, so marking this fixed...