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 rdf module:
- 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
Provide patch.
User interface changes
None.
API changes
None.
Follow-up issues
None.
Comment | File | Size | Author |
---|---|---|---|
#45 | rdf.1418980.45.docs-cleanup.patch | 9.64 KB | sidharthap |
#37 | rdf.1418980.37.docs-cleanup.patch | 9.67 KB | Gaelan |
#33 | doc-cleanup-rdf-1418980-33.patch | 4.31 KB | batigolix |
#31 | doc-cleanup-rdf-1418980-31.patch | 4.31 KB | batigolix |
#26 | drupal-1418980-26-clean_api_docs_rdf.patch | 9.38 KB | batigolix |
Comments
Comment #1
kotnik CreditAttribution: kotnik commentedRDF API documentation clean-up.
Comment #2
jhodgdonThanks for taking this on!
I took a look at this patch, and I have a couple of concerns:
a)
Normally we don't document return values of hooks, since it would just (usually) repeat the documentation of the hook itself. If there is a reason to document the return value (to clarify specifically what this hook implementation is doing), then the documentation should be more explicit. "Supported RDF namespaces" doesn't really tell me the PHP structure of what is being returned -- what's in the array? Is it a list of names, a list of objects, or what? Anyway, unless it's different from the docs in hook_rdf_namespaces(), just leave it out. See http://drupal.org/node/1354#hookimpl for the standard.
b)
Here too, maybe some explanation of what type of PHP thing an "RDF namespace" is (or a link to another function that explains it) would be helpful?
c)
Adding types to parameters and return values is out of scope for this cleanup, and it makes the patch *much* harder to review (I would have to read every function and see if the types are all correct). See instructions on #1310084: [meta] API documentation cleanup sprint for notes on this.
d)
The second paragraph here should probably start with "The" or "This"?
e)
Although we usually want @todo lines to be at the end of documentation, in this case it refers to the comment that was directly below it, so I think it needs to stay there?
f) This is in rdf.module -- needs fixing in this patch (1st line 80 characters or less):
g) The rdf.test file needs to be fixed in this patch, and isn't included.
Comment #3
jhodgdontagging
Comment #4
adnasa CreditAttribution: adnasa commentedWouldn't it be optimal to update the docs according to the current api?
for example this patch gives very short descriptions of what the
@return
values actually are, such as followingwhere actually according to the actual api docs we get
See doc here
Comment #5
jhodgdonCheck http://drupal.org/node/1354#hookimpl for standards for hook implementations. The patch should just omit the return value unless that hook implementation is doing something other than what the hook docs themselves say.
Comment #6
adnasa CreditAttribution: adnasa commentedI cleaned up the data types of the
@return
and@param
documentation.Did what I could on the .test file, since I don't have the extensive knowledge for it. one line :-)
Hopefully this was nice.
Comment #8
adnasa CreditAttribution: adnasa commented#6: drupal-1418980-6-rdf_module_docs_cleanup.patch queued for re-testing.
Comment #9
jhodgdonIt could be the patch is failing to apply due to some stuff about binary files right at the top of the patch?
Comment #11
xjmTestbot was unable to apply the patch, so retesting it won't help in this case. The patch probably needs to be rerolled against the latest branch tip. Thanks!
Comment #12
xjmOops, crosspost.
Comment #13
scor CreditAttribution: scor commentedplease do not include these files
???
Comment #14
kotnik CreditAttribution: kotnik commentedPatch that addresses comments in #2 attached.
Comment #15
kotnik CreditAttribution: kotnik commentedComment #17
jhodgdon#14: drupal-1418980-14-rdf-api-cleanup.patch queued for re-testing.
Comment #18
jhodgdonThanks! This is mostly very good. A couple small things to fix:
a) rdf.module
(right at the bottom)
b) rdf.module
I think that the @todo is referring to the comment just below the @todo line, so I would not move it to the bottom of the doc block. :)
c) rdf.test
Test -> Tests
d) rdf.test
I think the correction should be "is" not "are".
... proper RDFa markup is included...
Comment #19
scor CreditAttribution: scor commentedJust in case it is not very obvious in the output above and in @jhodgdon's, the last line is missing a space at the beginning - if you use dreditor you will see it clearly, highlighted in blue.
Comment #20
hansyg CreditAttribution: hansyg commentedRecreated patch per #18
Comment #21
scor CreditAttribution: scor commentedLooks good to me this time.
Comment #22
xjmThanks @scor and @hansyg! I found a couple of minor issues:
The word "Return" should be removed here. Also, we need an article (the mapping).
hook_entity_info_alter() should have parens here.
Comment #23
kotnik CreditAttribution: kotnik commentedUpdated with comments in #22. Patch attached.
Comment #24
xjmThanks @kotnik! Those changes look correct and I think everything in the patch itself looks fine now.
I just applied the patch locally and checked through quickly, and it seems a few things are still missing. For example, in
rdf.test
,RdfMappingHookTestCase
still does not have a docblock, and several docblocks begin with "Test" rather than "Tests." Many functions inrdf.module
also do not have summaries that follow the standard.Comment #25
batigolixI'll give this a try
Comment #26
batigolixAttached patch incorporates comments from #24.
I suppose rdf.test has been removed from the latest 8.x
Comment #27
jhodgdonAll of the former .test files have, over the past couple of weeks, been moved into files (one class per file) under core/modules/(module_name)/lib/... in each module. So you probably need to look at that sub-directory and apply the changes that were previously part of rdf.test to the appropriate files there. It wouldn't hurt if you checked all the files there to see if they need any other updates (otherwise, someone else will have to do it anyway).
Comment #28
batigolixI did check those files, and fixed numerous instances of the wrong verb tense, for example. The fixes are included in the patch at #26.
Comment #29
jhodgdon#26: drupal-1418980-26-clean_api_docs_rdf.patch queued for re-testing.
Comment #30
jhodgdonI went ahead and committed the patch above, since everything in it is good and it's been sitting here for a long time. Thanks!
But the RDF module directory needs some further work. For instance in the CommentAttributesTest.php file, I found this:
(needs a one-line summary).
So if someone could go through all the tests and fix up the methods, and make a new patch, that would be good! Remember, in tests we don't document getInfo() or setUp() methods (sigh).
Comment #31
batigolixallright, here's a new patch with fixes for the files in the lib/Drupal/files/rdf/Tests folder
Comment #32
scor CreditAttribution: scor commentedThis patch has some whitespace issues visible in dreditor
Comment #33
batigolixGot rid of the whitespace issues
Comment #34
scor CreditAttribution: scor commentedwhat's in the patch looks great to me.
Comment #35
kotnik CreditAttribution: kotnik commentedJust the things that were missing.
Comment #36
jhodgdonThanks! Committed to 8.x.
I think it's time to port this whole thing to 7.x now. (two different patches were committed)
Comment #37
Gaelan CreditAttribution: Gaelan commentedBackported to D7.
Comment #38
Gaelan CreditAttribution: Gaelan commentedNote: that was #33 and #24 combined.
Comment #39
YesCT CreditAttribution: YesCT commentedthis seems like it could use a type, or example values. Is it a string?
Also, should say what the default value is... Oh, I guess not. http://drupal.org/node/1354#functions was updated.
there are a few places that have an extra space at the end of lines.
Comment #40
star-szrComment #41
star-szrPoint 1 in #39 is out of scope for this issue per #2 (point c). The whitespace needs to go, though :)
Comment #42
sidharthapHi
I tried to remove the white spaces. I have a fresh D8 clone. The patch file #37 shows file
diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test but in my RDF module there is no file called as rdf.test but it contains a test folder. Please correct me i am wrong.
Comment #43
jhodgdonThis is a Drupal 7.x issue -- maybe that is the problem?
Comment #44
kbasarab CreditAttribution: kbasarab commentedSidharthap. As jhodgdon mentioned you'll need to clone out Drupal 7 for this issue as its a backport.
You can follow the same instructions you did for 8 but changing it to 7:
http://drupal.org/node/3060/git-instructions/7.x
Install that and then work on your patch from there.
Comment #45
sidharthapThank you @Kbasarab, @Jhodgdon, Here is the patch file.
Comment #46
kbasarab CreditAttribution: kbasarab commented#45: rdf.1418980.45.docs-cleanup.patch queued for re-testing.
Comment #47
jhodgdonOh gracious, this has been around for a long time -- sorry for the lack of reviews!
This all looks good except in rdf.test, several functions need a blank line inserted after the first documentation line, such as:
There are at least 5 methods with this same problem.
Comment #48
gyuhyon CreditAttribution: gyuhyon commentedComment #49
gyuhyon CreditAttribution: gyuhyon commentedComment #49.0
gyuhyon CreditAttribution: gyuhyon commentedFixed name
Comment #50
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!