Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of meta-issue #1310084: [meta] API documentation cleanup sprint
Comment | File | Size | Author |
---|---|---|---|
#23 | 1355670-23-search-docs-cleanup.patch | 27.45 KB | dcam |
#21 | doc-cleanup-search-module-1355670-21.patch | 28.54 KB | pwolanin |
#17 | doc-cleanup-search-module-1355670-17.patch | 51.4 KB | NROTC_Webmaster |
#17 | search-interdiff.txt | 1.69 KB | NROTC_Webmaster |
#15 | doc-cleanup-search-module-1355670-15.patch | 51.08 KB | NROTC_Webmaster |
Comments
Comment #1
jhodgdon@Sree: Are you still planning to work on this issue? If so, please respond. Otherwise, we'll come back in a few days and unassign it so someone else can. Thanks!
Comment #2
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedFirst attempt. Not ready for review yet.
Comment #3
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedReady for a first review.
Comment #4
jhodgdonThanks -- looks pretty good! I noticed a few things that need fixing (just looking at the patch so far; I didn't go look at the files to see if anything not in the patch needed fixing too):
a)
Isn't this a submit handler for a form? If so, http://drupal.org/node/1354#forms
b)
Should say Page callback... Hmm... Actually it looks like it's a form generating function?
c)
@see should be omitted here. See above link for form generation functions standards. Same for the submit handler in the next block.
d)
I think it's actually search_admin_settings() without form() on the end? And no @see as in (c).
e)
This is a hook. Wrong verb tense. See http://drupal.org/node/1354#hooks -- same for all other hooks in this file.
f)
This is actually referring to the module that initiates the search, not the Search module itself, so should be left lower-case.
g)
Actually should be bool and should not end in . -- see http://drupal.org/node/1354#classes and http://drupal.org/node/1354#param-return-data-type -- and this applies to other @var lines in this file.
h)
This is not accurate. The function returns $this, so it can be chained. I'm not sure how we're documenting that, but look at the other database API functions, such as SelectQuery->fields() etc.
i) search.module
Needs @see to search_menu(), see http://drupal.org/node/1354#menu-callback
j) search.module
Doesn't follow form-generating function standards. Also, the following function is the submit handler and needs to be documented as such.
k) search.pages.inc, top of file:
Should say Page callback.
l) search.pages.inc
Should be something more like:
And the same applies to the next function.
m) search.pages.inc:
Isn't this a form submission handler?
n) search.test
Maybe "Verifies that..."? (same for the other _test functions in the file). Also this type of wording:
Should probably be "Tests that...", which is sometimes used in this file (let's be consistent).
o) This made me laugh in search.test:
monotonous -> monatomic (I mean, they might be boring, but I think what was meant was uniformly increasing).
p)
This either needs to be made into a list or a paragraph (probably paragraph). Wrapping is not good currently.
q)
hook_search_page() needs ()
Comment #5
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedI will try to correct the issues identified, but with the addition of new subfolders I have a question.
The SearchQuery.php file starts off with
I'm not sure if this is correct or not.
I also don't know if you actually meant monatomic or more likely monotonic. The definition for monatomic is - Consisting of one atom.
Hopefully the next version will be better. I have problems with verb tense and I'm still learning the doc standards. Thank you for taking the time to explain things.
Comment #6
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedAdditionally, for c) why should the @see be omitted? It is listed in the example for both validation and submission handlers.
for h) tim.plunkett was kind enough to point me to #1336726: Document which database methods can be chained (make sure it's correct) but since it is still open I'm not sure what the right answer is here either. I also couldn't find any examples that had the return documented.
This is only a partial patch and I still need to go through the new files in the directory along with the answers to the questions noted above.
Comment #7
xjmRe: #6: It should be omitted because it's redundant.
Form validation handler for my_form_constructor_here_form()
This is actually exactly what's documented in the examples at http://drupal.org/node/1354#forms. :)
Comment #8
xjmOh, regarding #5, there's an issue for that too, when a file defines one class. Let me see if I can find it.
Edit: Sorry for the noise. See the @file docs under "Files containing the definition of exactly one class": http://drupal.org/node/1354#files. The original issue was #1392754: Comply with new documentation standards for @file for namespaced class files.
Edit 2: snarky aside at snarky comment:
I imagine you probably can infer that it's neither boringly repetitive nor one atom in size. Quantum computing hasn't advanced that far yet. ;)
Comment #9
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedxjm,
RE #7 That makes sense. I don't know why I didn't get it at first.
RE #5 Maybe I wasn't clear but the file has two @file in the file. Is this correct? I would think that it is wrong but I don't know of anywhere that specifies you cannot have two @file in one file.
For #4 Comment h) should I list the return as
Comment #10
xjmOh! Haha. Yeah two file docblocks is definitely wrong. If there is only one class in the file (which I think there must be for PSR-0):
Edit: Regarding the return value, how about something like "The updated query object" or something?
Comment #11
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedIn both Select.php and Query.php the @file is above the namespace declaration so I'm going to leave it there for now. If after reviewing the others you think it should still be moved I will.
Also in search.test it has
Should I change the description or just update the list formatting?
I'm having problems creating the interdiff. I'll upload it if I get what I think you are looking for.
Comment #12
jhodgdonRE question in #11 - yes definitely change the description! And update the list formatting. :)
Comment #13
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedHere is the updated patch.
I'm also attaching an interdiff from #3 but I'm still not sure if this is the right way to do it or not.
Comment #14
xjmThis patch looks great to me. I only found a few things:
I think this should begin with a third-person verb; maybe "performs"?
I think @jhodgdon previously suggested elsewhere marking "required" and "default" keys similarly to "optional" ones, e.g.:
I think
$result
and$module
should not have$
; they are just string literal keys for the array (even though they are used as variables in the theme layer).I guess the only remaining thing is to explain what _test_ and _test2_ are (I meant to mention this earlier but forgot, sorry).
We need to remove the (issue) from the end of these lines; the
@see http://example.com
should be all by itself on the line.I think "marked-up" should be hypenated here. Or maybe just "a string with markup" or something.
This test predates the patch, of course, but this docblock contains several errors. "include" is misspelled; I think "e-commerce" should be hyphenated; and there's no need to editorialize about the forms being important. I'd just say something like "A sample use of an embedded form is..."
Comment #15
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedRegarding #4 at the top of the search.test file it is explained as
Should I do @see SEARCH_TYPE
The only problem with this is that they have single line comments which do not show up in the documentation.
Interdiff from #13
Comment #16
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedActually disregard the last. I will add docblocks for the constants as required #constants
Comment #17
NROTC_Webmaster CreditAttribution: NROTC_Webmaster commentedHere is the latest version of the patch. I'm having problems creating a diff against #13 but there is a diff from that to 15 and here is the one from 15 which only adds the @see to the constants and the docblocks for the constants.
Comment #18
jhodgdonI took a look at the patch in #17, and it is mostly very good! However, it still has a few problems:
a) Why is this patch removing the @file block here?
b) SearchQuery.php
"Search" should not be capitalized here. It is not referring to "The Core Search Module", it is referring to any add-on module that performs searches.
c) search-result.tpl.php
- dependent to -> dependent on
- I think there should be a comma after "another".
d) search-result.tpl.php has the same problems as (c).
e) search.admin.inc
Confirm -> Confirms
f) search.admin.inc
First line - see http://drupal.org/node/1354#forms - should have search_reindex_confirm() in it, not "for the wipe confirmation". This also applies to search.module:
g) search.module
This parameter description is not correct. $name is the name of a search tab (i.e., search module), not a user ID. And the @return should then say "TRUE if the current user has access to the given search tab; FALSE otherwise.".
h) search.pages.inc - doc for template_preprocess_search_results():
- First line should probably say preprocesses, not processes?
- $variables elements are not "$results" but "results", etc.
- Same two comments apply to template_preprocess_search_result() immediately after this function.
i) search.test
I actually think this was clearer with the original list notation. Why was the list removed?
Comment #19
jhodgdontagging
Comment #20
pwolanin CreditAttribution: pwolanin commentedThis patch no longer applies
Comment #21
pwolanin CreditAttribution: pwolanin commented@jhodgdon there were 2 @file blocks it seems.
Here's a re-roll trying to take into account the comments in #18.
Comment #22
jhodgdonThis looks good -- thanks to all who participated -- committed to 8.x!
Let's backport as much as we can of this to 7.x as well. The tests will of course be in different locations/files, but the rest will probably port quite easily.
Comment #23
dcam CreditAttribution: dcam commentedBackported #21 to D7.
Comment #24
jhodgdonThese issues are a lot of work with very little tangible payoff, so I'm closing the rest of them as "won't fix". Your efforts on working on this issue were appreciated... it was just my fault for starting a task that was very difficult to get right.
Let's instead put our effort into fixing and reviewing documentation that is really unclear and/or wrong, and I hope that the people who worked on these issues are not afraid to jump into a more reasonable issue!