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.
Problem/Motivation
Part of meta-issue #1310084: [meta] API documentation cleanup sprint
Proposed resolution
Correct the following in the core taxonomy module:
- Ensure that each file has an
@file
docblock. - Ensure that all
@return
lines are preceded by a blank line. - Ensure that
@see
and@ingroup
lines are always at the end of docblocks. - Ensure that all lines in doxygen blocks are 80 characters or fewer (excluding the terminal newline).
- Ensure that all functions, classes, interfaces, and methods have one-line summaries that are clear, use the correct verb tense, and follow specific standards in http://drupal.org/node/1354.
- Make incidental style and grammar corrections only to those docblocks already being updated.
Remaining tasks
Patch needs to be rolled.
User interface changes
None.
API changes
None.
Follow-up issues
None.
Comment | File | Size | Author |
---|---|---|---|
#35 | interdiff.txt | 72 KB | pfrenssen |
#35 | drupal8.documentation.1326644-35.patch | 82.43 KB | pfrenssen |
#33 | drupal8.documentation.1326644-33.patch | 15.38 KB | Albert Volkman |
#33 | interdiff.txt | 3.53 KB | Albert Volkman |
#31 | drupal8.documentation.1326644-31.patch | 15.33 KB | Albert Volkman |
Comments
Comment #1
jhodgdonDo you plan to patch this module? If so can you assign the issue to yourself and also add your name to the summary issue? Thanks!
Comment #2
xjmThe patch for this issue should include correcting the docblock fortaxonomy_autocomplete()
as described in #992020-25: Taxonomy autocomplete does not respect cursor position..Not anymore. :)
Comment #3
xjmI know taxonomy.module pretty well and I also know what issues the patch is likely to collide with. Tentatively assigning this one to myself for that reason. Going to wait for includes A-C to land before I start, though.
Comment #4
jhodgdontagging
Comment #5
xjmJust waiting on the includes issues to get in before I do Taxonomy.
Comment #5.0
xjmUpdated issue summary.
Comment #6
jhodgdonI'm going through these issues and un-assigning any without activity for several weeks. If you still want to work on this issue, please feel free to assign it back to yourself. Thanks!
Comment #7
xjmI need something that's not too demanding to work on between meetings today, so I'm going to look at this issue again. In the spirit of keeping the scope narrow, I'm going to start with just the first three points from the summary, since that should be really easy to rebase around.
Comment #8
xjmTurns out there weren't that many formatting errors, so I also took care of rewrapping/rewriting the few lines that were over 80 characters. I'd say do the summaries separately, if that's cool with @jhodgdon.
Comment #9
xjmComment #10
Lars Toomre CreditAttribution: Lars Toomre commentedAll of the changes in the patch are appropriate.
The only thing I noticed is a very small nitpick: 'An array ' line needs one more space before 'An ...'.
Comment #11
andypostThe only questinable hunk. Function returns build array so "renders" probably better to replace with "builds"
Comment #12
xjmThanks @andypost and @Lars Toomre.
That line is part of the diff context, not part of the changed lines, so it's not in scope. See: http://webchick.net/please-stop-eating-baby-kittens
#11 is correct though; I agree that "Builds" is better.
Comment #13
Lars Toomre CreditAttribution: Lars Toomre commentedI started with the work that @xjm had done in #8 and went through all of the files in the top level of Taxonomy module trying to do the heavy lifting that would bring those files closer to D8 coding standards.
I am sure that I may well have overlooked one or more of the guidelines in http://drupal/org/node/1354. However, I think this moves us closer, much like #1313980-78: Clean up API docs for node module for the Node module and #1326672-51: Clean up API docs for menu module for the Menu module. Comments are welcome on all three issues.
Attached is an untested patch and interdiff with #8.
Comment #14
jhodgdonThe patch has a couple of different sections with the same files in them?
Comment #15
Lars Toomre CreditAttribution: Lars Toomre commentedMy git skills are still evolving. I see that #13 is a format-patch version that I neglected to squash first.
Here is the same patch that is squashed first. Thanks for bearing with me @jhodgdon.
Comment #16
c-c-m CreditAttribution: c-c-m commentedPatch #15 works fine to me.
Rerolled patch with this changes:
-Changed taxonomy-term.tpl.php location. From core/modules/taxonomy/ to core/modules/taxonomy/templates
Comment #18
Lars Toomre CreditAttribution: Lars Toomre commentedThanks for testing this @c-c-m and I am glad that it works fine for you. Did you review the changes line by line?
Also, I do not think the move of the *tpl location is appropriate for this issue.
Comment #19
c-c-m CreditAttribution: c-c-m commented@Lars yes, I did check all changes you made, line by line.
I do not understand what do you mean about tpl location. Patch in #15 failed to apply due to wrong path, and that's what I wanted to fix (which seems I have failed -it's my first patch and first drupal core contrib).
Comment #20
Lars Toomre CreditAttribution: Lars Toomre commented#15: 1326644-15-taxonomy-docs.patch queued for re-testing.
Comment #21
Lars Toomre CreditAttribution: Lars Toomre commentedAh @c-c-m, I did not understand that the patch in #15 no longer applied.
It looks like core changed as you pointed out in #16. Let me try to re-roll #15 after a git rebase.
Comment #22
Lars Toomre CreditAttribution: Lars Toomre commentedHere is a re-roll of the patch from #15 after the move of *.tpl to a templates directory in each module. Let's see what the bot thinks of this untested locally patch.
Comment #23
Lars Toomre CreditAttribution: Lars Toomre commented@jhodgdon As I currently understand our policy for patches such as #22, there should be no type hinting added to any docblocks, unless there is a missing @param and/or @return directive. (In those cases, the whole function needs to be reviewed in any case to ensure that the additions are appropriate and correct.)
After creating patches in the last couple of weeks such as #22 above for modules like Menu, Node, System, Taxonomy (and today I am working on a full review of User) modules, I have a request to modify the above policy slightly.
Since it is so important for developers to understand how to properly use the hook system, I would request that henceforth these patches allow for type hinting of all functions in *.api.php files.
As the key reviewer (in many cases) and core committer, @jhodgdon I am interested in your thoughts on this proposed modification. Thanks in advance.
Comment #24
jhodgdonRE #23 - just file separate issues for hooks that need better documentation. Thanks!
Comment #25
Lars Toomre CreditAttribution: Lars Toomre commentedI added a small patch to #1807002-1: Add missing type hinting to Taxonomy module docblocks that adds missing type hinting to the file taxonomy.api.php.
Comment #26
jhodgdonThis looks overall pretty good, thanks!
A few things to clean up:
a) We don't normally include @param $form in form constructors [taxonomy_overview_vocabularies()]
b) In-code comments should be left out of these patches and done on the Coder Review issues instead. And definitely any other code formatting and code line changes do not belong in this patch.
c) When creating @return docs, we don't normally include "Returns" in the documentation, such as here:
Should just say "The built and processed..."
d) All the first-line changes to verb tense in hook docs in taxonomy.api.php are incorrect, see
http://drupal.org/node/1354#hooks
e) In taxonomy.module:
This doc block is not documenting anything. The text here should be moved to some doc block that is actually documenting something: a defgroup, the @file block, a function, or ... ??? but it is not doing anything useful here.
f) Punctuation around e.g. -- should always be "blah blah blah; e.g., a, b, or c.".
g)
The passed-in value is the term object, not the term ID, so this @return doesn't quite make sense?
h)
@return ... should be "the given term ID" at the end... and what are "ancestor terms" -- are they term IDs, term objects? Maybe should also start with "An array containing..."?
i)
$tags -- is it an array of term IDs, term objects, or what?
j)
I don't think we want to remove the '' here. This is I think a literal string?
Comment #27
Lars Toomre CreditAttribution: Lars Toomre commentedI am going to have to let someone else drive this issue home. Despite repeated attempts, I cannot retrieve the patch in #22. I have no clue why, but the net result is that I have no place to start from locally.
Comment #28
Albert Volkman CreditAttribution: Albert Volkman commentedRe-roll of #22 against current head. Still needs fixes from comment #26.
Comment #29
Albert Volkman CreditAttribution: Albert Volkman commentedUpdated patch with comments from #26.
Comment #30
pfrenssenComment #31
Albert Volkman CreditAttribution: Albert Volkman commentedRe-roll.
Comment #32
jhodgdonThere are still many problems with this patch:
a) One line of my pet peeve of "ids" instead of "IDs" in here:
b) This change to taxonomy_get_children() is also wrong:
"An vocabulary" => "A vocabulary". And if you are going to say what it defaults to here, saying it defaults to zero is useless because obviously zero is not a valid vocab ID. Either leave that out or explain what it means; preferably leave it out, since saying it's optional implies that if you don't provide it, there is no restriction, right? All of this "defaults to NULL" stuff is really dumb when it provides no information and drives me crazy!
c) Here's another one:
It says "leave NULL to..." so "Defaults to NULL" is just redundant. Waste of typing and space and bytes to include this stuff.
d) And another one where it just makes you go "huh?":
If omitted... defaults to NULL? What? This occurs several times. IMO "Defaults to NULL" here is not only redundant but confusing.
e)
If you use a namespace in docs, it MUST start with \
Comment #33
Albert Volkman CreditAttribution: Albert Volkman commentedGot rid of the "Default to NULL" stuff, fixed namespace docs.
Comment #34
ceardach CreditAttribution: ceardach commentedRemoved "Needs reroll" because requested changes have been included in the latest patch.
Comment #34.0
ceardach CreditAttribution: ceardach commentedUpdated issue summary.
Comment #35
pfrenssenDid an iteration on this. I vastly underestimated the amount of work that was left, continued until I ran out of steam. There is still a lot of work to be done. Especially the Views integration has very poor quality documentation.
I also fixed some whitespace problems which I noticed, hopefully I did not step out of the issue scope with those.
I pondered on this for a while but couldn't come up with a fitting description that fits in 80 characters, so some help from a native English speaker is welcome:
Comment #36
jhodgdonI really think we should just drop all of these "clean up the API docs" issues. They are nearly impossible to get right and require a huge amount of time to review. Sorry... I've said this before... let's really just close this?
Comment #37
pfrenssenI'm ok with that, this almost caused me to never want to touch documentation cleanup issues again ;)
Comment #38
jhodgdonOK then...