Problem/Motivation
Suggested by @jhodgdon here: #1816782-9: Add missing type hinting to Field_ui module docblocks
Various @see annotations are structurally incorrect, with trailing punctuation and extra comments.
Drupal coding standards for @see: https://www.drupal.org/coding-standards/docs#see
Proposed resolution
Fix all @see annotations so they are correct. Emphasize coding standards correctness over changing content.
Use a phpcs command similar to this:
phpcs --standard="Drupal" --extensions="module/php,inc/php,php" --report-csv --ignore=vendor/ PATH/TO/REVIEW | grep -F @see
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
mile23Here's a patch of (mostly) everything but
core/modules/. Only skipped because it's close to dinner time. :-)Some stuff:
There are a few places where a
@seewas used as a substitute for describing@params, like this:In these sorts of cases, there are now no
@paramdescriptions (because there really weren't to begin with), and the@seeis moved to its proper place in the docblock.Also, places where I was already working on the file, and I saw that
@seeonly referred to a class-local method, I expanded the reference to include the class, like this:It's a coin toss as to whether @see will come after or before @defgroup or other such directives. I concentrated on having adequate spacing around these (blank lines), rather than order, since there's no rule for it in phpcs.
The main problem in reviewing this patch will be how much memory phpcs has available on your machine. :-)
I used a phpcs script like this:
Comment #3
mile23Comment #4
jhodgdonThanks for filing this issue and starting on a patch!
As a note, there is actually a standard for the order of @tags in documentation blocks:
https://www.drupal.org/node/1354#order
I do not know if it has been added to the Drupal sniffer, but we do have a documented standard.
I also took a quick look through the patch, and there are some things in there I think are not really optimal:
Here, the correct fix should really be that @see is changed to the word "See" and the reference/link is left where it is. Moving the @see to the bottom of the doc block loses the context that this was intended for. Whoever created this doc block should not have put @see there but should have just incorporated the information into the docs directly.
This kind of fix seems to be to be out of scope for the issue.
Again, here I think this was not a very good fix for the docs. We lost information. Better fix is to change @see to "See".
I realize a script cannot make this kind of judgement call probably, but if these kinds of fixes are in the patch I do not think we should commit it.
Comment #5
mile23I think we might define scope here as anything you find when you run the phpcs command:
phpcs --standard="Drupal" --extensions="module/php,inc/php,php" --report-csv --ignore=vendor/ PATH/TO/REVIEW | grep -F @seeThat way the patch is easier to generate and is also easier to review.
So therefore #4.2 is in scope, and tag ordering isn't (since we don't have sniffer rules about it for @see).
1 and 3 are a bit ambiguous, yah, so thanks for the ruling. :-)
Comment #6
jhodgdonNote that the review in #4 -- I didn't look through the whole patch for this type of problem mentioned in items 1/3. There are probably more. People use @see quite a bit when they shouldn't be doing it. Probably any time it's scrunched into a paragraph, it should be replaced with the word "See", and if it's kind of off by itself, it should be moved to the bottom and fixed up. Maybe a script could figure that out, or at least make decisions closer to items 1/3?
Comment #12
David_Rothstein commentedHere is an issue that focuses specifically on the @see inside @param problem and that might have some overlap with this one.
Comment #14
avpadernoComment #16
himanshu_sindhwani commentedThis issue seems to be fixed in Drupal version 9.1.x-dev . I ran the above command mention in issue summary and it displays no results. Then I manually checked into some files mention in patch #2 and couldn't find the issue in this version.
Comment #17
himanshu_sindhwani commentedComment #19
sulfikar_s commentedThe patch in #2 needs reroll in 9.2.x-dev. As said by @himanshu_sindhwani some of the areas are already covered in 9.2.x-dev, but some files still needs work!
So changing the status to Needs work!
Comment #20
suresh prabhu parkala commentedPatch re-rolled against 9.2.x. Please review!
Comment #21
suresh prabhu parkala commentedSorry for the noise. Applied new patch please review.
Comment #22
suresh prabhu parkala commentedComment #24
quietone commentedComment #27
quietone commentedI'm closing this as a duplicate of a later issue, #3102478: [PP-1] @see tags don't use fully qualified class/interface names, which has more discussion. Transferring credit over there.
Thanks for working on this.