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 |
---|---|---|---|
#34 | d7-aggregator.patch | 24.03 KB | xjm |
#34 | manual-diff.txt | 18.39 KB | xjm |
#30 | aggregator-clean-up-documentation-1325116-30.patch | 2.33 KB | xenophyle |
#25 | catch-breaks-patches-1325116-25.patch | 30.85 KB | xjm |
#25 | interdiff-23-25.txt | 537 bytes | xjm |
Comments
Comment #1
xenophyle CreditAttribution: xenophyle commentedThere were a few functions I wasn't sure how to handle, i.e., whether they should be documented as form constructors or page callbacks: aggregator_admin_remove_feed(), aggregator_source_form(), and aggregator_page_category_form().
Comment #2
jhodgdonGood start, thanks! A few comments:
a) For functions that are both page/form, I suggest:
* Page callback: Form constructor for the ...
(i.e., a combination of the page callback and form constructor standards, since the function is both) -- and @see links to the submit/validate handlers if there area any.
Also, note that for page callbacks and form constructors, you don't need @return generally, unless it's doing something odd/special.
b)
Needs to end in .
c)
Should either be "the Aggregator module" or "aggregator.module". The latter is somewhat better, as it makes a link on api.drupal.org
d)
First line of function description needs to be one 80-character line/sentence, followed by blank line. This occurs several times in your patch.
e)
Wrap next line along with the modified line.
f)
See http://drupal.org/node/1354#functions -- scroll down to the Callbacks sub-section.
Comment #3
xenophyle CreditAttribution: xenophyle commentedSo to be clear, should functions that are both form constructors and used in page callbacks always use
the combination page callback/form constructor documentation, or just in these odd cases?
As always, your fast responses are awesome.
Comment #4
jhodgdonAlways, I think -- don't you agree that that would be the best way to meet both standards?
Comment #5
xenophyle CreditAttribution: xenophyle commentedMakes sense to me. I just wanted to make sure before I went crazy and changed all the form contructor/page callbacks.
Comment #6
xenophyle CreditAttribution: xenophyle commentedTrying again. For comment d, I'm not sure that I was able to find all the examples you were referring to, but I changed everything I could find.
Comment #7
xjmHey @xenophyle; here's what I found reading through the patch. There are some things that are grammatical cleanups not specifically targeted by the sprint, and a few others that should be fixed in the patch for sure:
While we're changing these lines, do you think we should correct the run-on sentences? Maybe:
There's a missing space here after the period and before the variable name.
I think the verb tense needs to be fixed here ("Exposes") and we can replace the word "your" with an article ("the" or "a," depending on what you think is more appropriate in context).
I think this needs to be "Removes."
I'd say "Determines" rather than "Finds out" here.
I'd either say "or FALSE otherwise," or add a semicolon as you have elsewhere.
I'd add commas after "parser" here for clarity.
I'd add an article (either "the aggregator configuration" or "an aggergator configuration," depending on what fits).
Can we add one-line summaries for these that describe what the functions actually do? Then a blank line, and the callback information after that. Also, I think we can eliminate the words "the XML parser function" and just say "Callback for xml_set_element_handler() within aggregator_parse_feed()."
Edit: And maybe parameter documentation while we're at it, but that's not required.
Technically this is outside the scope of the issue since these lines are not inside a docblock. (Reference: http://webchick.net/please-stop-eating-baby-kittens).
I'm not sure if I've caught everything this time through, but thanks for your patience and for all your work already. :)
Comment #8
xjmNote that this patch will need to be rerolled, because the core directory structure for Drupal 8 has now changed. (For more information, see #22336: Move all core Drupal files under a /core folder to improve usability and upgrades). If you need help rerolling this patch, you can come to core office hours or ask in #drupal-gitsupport on IRC.
Comment #9
xenophyle CreditAttribution: xenophyle commented@xjm, thanks for your input. I have a new patch with the changes, but I didn't change the verb tense for the hook documentation, since I think it's supposed to be the way it is, according to http://drupal.org/node/1354#hooks. I also didn't get rid of the "you"s in the same file, since it was consistent with the rest of the text, where they are instructing how to use the hooks, and also using "you". But let me know if you really think I should change it.
Comment #10
xjmSorry, I'm not sure what you're referring to here? Could you clarify which line you mean?
Comment #12
xjmNote that there is a testbot issue at the moment, which is why the patch failed. We'll want to re-test it once that is fixed.
Comment #13
jhodgdonre: hooks -- xenophyle is correct. Hook definitions (functions hook_*) in the api.php file should follow the verb/doc standards at http://drupal.org/node/1354#hooks , not the generic function verb/doc standards.
And I think the testbot issue is fixed... will try a retest.
Comment #14
jhodgdon#9: aggregator-clean-up-documentation-1325116-2.patch queued for re-testing.
Comment #15
jhodgdonI'm doing upgrades on my main computer, so I had some spare time to read carefully through this entire patch. It mostly looks great! A few things to finish up/fix:
a) aggregator_admin_remove_feed() and its validate/submit handler functions should all be linked with @see. Well, technically our standards (http://drupal.org/node/1354#forms) are that the form generator has @see to validate/submit, and the validate/submit have @see pointing to each other (since the main function is in the one-line description, it's not necessary to have @see too). Actually, I think this is the only form/validate/submit set in the file that isn't done this way -- the others look good. :)
b)
redirect -> redirects
c)
id -> ID. "id" is a psychological term. "ID" is short for identifier. This is a major pet peeve of mine. :)
d)
Not your fault, but in text, I wouldn't use "$feed" as an adjective in that first sentence. It should probably say "A feed object representing the resource to be downloaded.". Then using $feed in the rest makes sense, because it is referring (appropriately) to the actual $feed parameter. This also applies to some of the other hook docs in the same file. And maybe it shouldn't be fixed in this patch, but if you are touching that line anyway...
e) Usage/style nitpick:
"the title"... "a description" sort of bothers me. How about "Expose the title and short description..." Actually, maybe even "Specify the title and short description..."? What does being "exposed" mean? [This also occurs for the processor hook below.]
f)
Missing $ on $category.
g)
Technically, while this callback is set up by the call to xml_set_element_handler(), it's actually used in xml_parse(). This also applies to the next two callbacks.
h)
Needs verbification. :)
i) This is possibly better in another issue, but:
- I don't think $feed should be in a one-line description. Those are shown in all kinds of listings on api.drupal.org, and there is no reference point for what $feed is.
- What is aggregator_clear? Oh, I guess it's a variable, but that is not clear when looking at this description.
How about simply:
"Expires items from a feed, depending on expiration settings."
and then explaining in a new line how that is decided (if that is even necessary)?
Whew! Getting close...
Comment #16
xenophyle CreditAttribution: xenophyle commentedHere's what I put for your comment (h): "Creates display text for teaser length option values."
Let me know if you think it's not helpful.
By the way, when my college ID was falling apart, I thought it was clever to tell people I needed a new id. But I guess we don't need non-sequitur wordplay in the documentation.
Comment #17
jhodgdonLooks good to me -- thanks!
Comment #18
catch#16: aggregator-clean-up-documentation-1325116-3.patch queued for re-testing.
Comment #20
xjmNeeds one hunk resolved on account of #1247982: API doc for hook_aggregator_parse is incorrect. Attached patch is a reroll that applies the remaining corrections to the updated documentation. The attached text file shows that change; there are no other changes.
Comment #21
jhodgdonThanks, looks fine.
Comment #22
catchSorry I didn't mean to but I just broke this again with #743234: /aggregator does not use pagination. Another re-roll please?
Comment #23
xjmOnly change here is that
aggregator_load_feed_items()
docs already got cleaned up, so we drop that hunk.Comment #24
jhodgdonThis chunk also changed between your previous patch and #23:
Can you put that back to what it was?
Comment #25
xjmHm, fail. Attached re-removes the
@return
. I made a diff against the #20 file manually to make sure there weren't any other botched hunks, though I think that was the only change that was in the same hunk asaggregator_load_feed_items()
.Comment #26
xjmComment #27
jhodgdonracing catch again... :)
Comment #28
catchAlright, committed and pushed to 8.x, thanks for the re-rolls!
Comment #30
xenophyle CreditAttribution: xenophyle commentedUnclassify form constructors as page callback as per #1337282: Lacking doc header standard for forms used as page callbacks.
Comment #31
xjmYep, this is correct. (We will probably need a similar followup for
node.module
and perhaps others.)Comment #32
catchOuch good point, let's do those other follow-ups soon. Committed/pushed to 8.x.
Comment #34
xjmD7 backport without the menu callback standard, with helpful interdiff showing what I changed.
Comment #35
jhodgdonThanks! I think this is all fine for D7. My only slight worry was this bit:
Technically this is part of the menu standards, but it does also bring this doc block more in line with our older/d7 verb standards, so I would vote for letting it stand.
Comment #36
xjmYeah, I wavered about that as well, but since the words "Title callback" were already there, I figured the change was okay.
Comment #38
jhodgdonMy feeling exactly. By the way that failed testing on "failed to create checkout database" -- looks like a bot glitch, so I'll hit retest.
Comment #39
jhodgdon#34: d7-aggregator.patch queued for re-testing.
Comment #40
webchickYeah, I think we can let that slide.
Committed and pushed to 7.x. Thanks!
Comment #42
Lars Toomre CreditAttribution: Lars Toomre commentedI am reopening this issue because there is a missing directive in aggregator.api.php file. This was discovered while writing a patch in #1807160-1: Add missing type hinting to Aggregator module docblocks to add missing type hinting to the aggregator.api.php file.
I hope to write a patch for this issue shortly and will do a complete review of the module docs so there may be additional changes too.
Comment #43
xjm@Lars Toomre, instead of reopening old issues, please file new ones. Thanks!
Comment #44
Lars Toomre CreditAttribution: Lars Toomre commentedThanks @xjm. @jhodgdon indicated that we should use the existing ones. I will open a new issue.
Comment #45
xjmExisting ones if they're still open, sure, but this one was closed almost a year ago. :)
Comment #46
xjmAlso, in general, as a reviewer, I prefer new issues because it can get really confusing to track what's been committed and what hasn't. IMO reusing existing issues should only happen in the case that something needs to be reverted, or if a partial patch is committed as a stopgap but the issue isn't resolved.
Comment #47
Lars Toomre CreditAttribution: Lars Toomre commentedOpened #1807556: Further clean up of API docs for Aggregator module as a continuation of cleaning up the Aggregator module to conform with http://drupal.org/node/1354.