This issue isolates components of its parent issue #2259979: Docblock fixes in database system, part I, which had become too large to effectively manage.
Add/improve docblocs in the database driver system files.
- core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
- core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
- core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
- core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
- core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
- core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
This does not necessarily restrict this issue to these files. Also note, {@inheritdoc} additions aren't necessarily in the scope of this issue. The attached, initial patch comes unaltered (after rebase) from donquixote's work in comment #23 of the parent issue.
Beta phase evaluation
Issue category | Task because this change focuses on documentation only. |
---|---|
Issue priority | Normal because the work is more than simple formatting and whitespace issues. |
Unfrozen changes | Unfrozen because it only changes documentation. |
To do:
Review the changes and get this to RTBC.
Comment | File | Size | Author |
---|---|---|---|
#45 | 2343121-db-driver-docblock-45.patch | 47.19 KB | hussainweb |
#44 | interdiff-43-44.txt | 15.61 KB | hussainweb |
#43 | 2343121-db-driver-docblock-44.patch | 40.85 KB | hussainweb |
Comments
Comment #1
bburgComment #2
bburgRemoving summary of changes from alexpott's comment which were already addressed in #23 in parent.
Comment #3
jhodgdon@param still needs a description for each parameter.
Comment #4
Ben25 CreditAttribution: Ben25 commentedI am going to try solve this issue. Currently working at drupalcon amsterdam
Comment #5
mradcliffeBen25 had some issues with his dev environment so he is no longer working on the issue.
Comment #6
chrisryan CreditAttribution: chrisryan commentedWorking on updating patch to include more data on @params.
Comment #7
chrisryan CreditAttribution: chrisryan commentedComment #8
chrisryan CreditAttribution: chrisryan commentedFixed a long docblock comment.
Comment #9
jhodgdonThis is getting better! There are still quite a few things to fix though:
a) MySQL Connection object
The third exception here is probably OK to put in with just @throws without an explanation, because TransactionCommitFailedException is pretty clear. But for the first two, I have no clear idea from this documentation why/when a DatabaseExceptionWrapper would be thrown, or a plain Exception. So these need to be documented better. See https://www.drupal.org/coding-standards/docs#throws
b)
First lines of function docs should start with verbs like "Gets" not "Get". See https://www.drupal.org/coding-standards/docs#functions - this applies to several other lines in this patch, like in the PGSQL connection object:
c) Same class
Missing the $variable name on the @param line, and optionally the type of variable (should be string here, right?). See https://www.drupal.org/coding-standards/docs#param
Oh I see, it's below:
So move those two last @param lines up to replace the upper two @param lines.
d) same class
Generated should not be capitalized.
e) PGSQL connection class:
"id" should be "ID". "id" is a psychological term; "ID" means identifier. Please do that throughout the patch.
f) PGSQL connection class:
This is a nice explanation... but for a @param we want to start with a description of what the parameter value actually is. So it kind of needs rewording, like starting with "The maximum existing ID" or something like that.
g) same function
I would drop "the" before "$existing".
h) pgsql Schema class:
Should be @return object -- see https://www.drupal.org/coding-standards/docs#types
i) same class
Function is missing one-line description. There are a couple of other places like this in the patch.
Also the list in the @param needs some formatting attention: https://www.drupal.org/coding-standards/docs#lists (capitalization, no "or" at end of line, lines end with ., and preceding line ends in :). This also applies elsewhere in the patch.
j)
Why did you take out the inheritdoc?
k)
Needs blank line between one-line description and @param start.
Also "whose comments to return" isn't very good grammar here. How about "The database table to return comments for." instead? (and similar for the $column)?
l) SQLite Connection object:
"results to true" should be just "is TRUE" or "evaluates to TRUE". Also nothing is "returned" here, so ... maybe "Value if $condition is TRUE"?
Also do not do @return null. Just omit @return if there is no return value.
j) Same class
Variadic is not a word. Maybe "Variable" is what you meant? This occurs elsewhere in the patch too.
k) same code - in @param/@return types use "null" not "NULL".
l) Same class
@return needs a description. Same for sqlFunctionSubstringIndex just after this.
m)
First line should not have a break in it. Better to be one line slightly too long than two lines. Or maybe just say "SQLite implementation" and take out "specific" to make the line shorter?
Comment #10
gaurav101 CreditAttribution: gaurav101 commentedplease review the patch attached
Comment #11
mradcliffeThank you for the patch, @gaurav101!
One thing that is helpful for reviewers is to create an interdiff from the previous patch. I have created and attached one with the following command:
interdiff 2343121-7.patch 2343121-10-docblock-fixes.patch > interdiff.txt
Comment #12
mradcliffeGood work so far. The patch still needs to incorporate changes from comment #19.
A couple of issues here:
Comment #13
finnydobson CreditAttribution: finnydobson commentedThanks for the review Jennifer. I have gone through all the changes you suggested and here is what I did.
a) I have provided explanations for the first two lines
b) I changed the first line of function docs to start with verbs
c) I moved the @param lines to replace the other two lines
d) I have uncapitalised the word 'generated'
e) I have changed id to ID
f) I reworded the explanation of the parameter value
g) I dropped the word 'the'
h) I changed the stdClass to a return object
i) I gave function a one line definition and formatted the list
j) I put back the inheritdoc
k) I edited the sentence to be gramatically correct and added a blank line
L) I changed the NULL to null and omitted @return
j) I changed variadic to variable
k) I changed NULL to null
l) I gave a description for return and sqlFunctionSubstringIndex
j) I made the line shorter by removing 'specific'
Patch and interdiff attached. This is my second patch contribution to drupal :)
Comment #14
jhodgdonThanks!
There are still some problems in this patch -- some may not have been seen in previous reviews, sorry!
a) "an unique" should be "a unique".
b) /core/lib/Drupal/Core/Database/Connection.php
There is no * at the beginning of this line. Also "id" should be "ID" in text ("id" is a psychological term, while "ID" means identifier).. Also "Maximum existing ID" is not a sentence and it needs to be wrapped with the following lines to make a paragraph.
c)
All function descriptions should start with 3rd-person verbs like "Gets" , not "Get". This is all over the patch.
d) A few lines down
Needs the $variable on the first @param line, and a data type. The other params should be ... um... this is just wrong, please fix it. Should just be two @param lines, one for each actual function parameter.
e) Same class
"Generated" should be lower-case.
f)
"for retrieve" ?!? not good English.
g) in Schema.php
Please look at https://www.drupal.org/node/1354#lists for list syntax. Capitalization. Ending with . not ,
Also in the 2nd list item, I don't like using $field_name and $alias -- these are not real variables. Use words. Like "An array containing the field name and field alias."
h) same class
Why take out the inheritdoc block? The function needs *something* for docs. If it cannot inherit it needs added docs.
i) same class
Missing one-line description. Also see previous notes on list syntax.
j) same class
No @return.
k)
Indentation is wrong and class docs need to start with a one-line summary.
l) same class
This @return is incomplete.
At this point I decided the patch wasn't finished and stopped reviewing. There are similar errors in the rest of the patch.
Comment #15
finnydobson CreditAttribution: finnydobson commentedHi Jennifer, thank you for the review. What are your thoughts on dividing the patch into three, pgsql, mysql and sqlite. I think this is important because together they amass a lot of code and it could possibly be easier to handle.
Comment #16
jhodgdonI don't have an opinion on that. Up to you, but if you do that please file separate issues.
Comment #17
shipra.wasson CreditAttribution: shipra.wasson as a volunteer and commentedchanges made for #14
Comment #18
David Hernández CreditAttribution: David Hernández commentedHello!
Thank you for working on this issue!
We should all try and use the same sprint tag. According to https://groups.drupal.org/node/447258 it should be SprintWeekend2015 with no #.
Comment #19
jhodgdonWhen you upload an update to a big patch, PLEASE make an interdiff file. That way we can review the changes you made.
https://www.drupal.org/documentation/git/interdiff
Comment #20
LinL CreditAttribution: LinL commentedAs a start to reviewing, here's an interdiff for patches 13 - 17.
Comment #21
jhodgdonThanks for the patch in #17 and the interdiff file!
Regarding this patch in general... I'm not sure if the SQLite compatibility function return value docs are correct -- I really doubt that they're returning SQL results. They're doing something to queries.
And ... for the other functions being documented, they also need careful reviews to make sure the content is correct.
So I've mostly reviewed writing style and formatting. There are still some things to fix:
a) Connection.php
This is not great documentation. Parameter documentation should be something like "The maximum existing ID", not "This must be a maximum existing ID", and "Maximum" should not be capitalized in any case.
b) Also all of the documentation in an @param should be wrapped together into one paragraph with lines as long as possible (but staying under 80 character lines).
c) #14 (c) was not addressed.
d) The @param changes in Schema.php do not have the correct indentation. See https://www.drupal.org/node/1354#param
e) Schema.php
We don't need that sentence about the default. It doesn't give any information beyond the function signature.
f) Connection.php
There should always be a blank line between the end of one function and the start of the next function doc block.
g) Connection.php
The indentation of */ is wrong, and there should not be a blank line between documentation and function.
h) Schema.php
Too many spaces before Generates. Should be just one.
i) Schema.php
I do not think this @return is correct?
k) Connection.php
Um. What? This needs to be a class documentation block. If you want to add it to the database group, use @ingroup not @addtogroup, and that should go at the end of the class documentation block.
Also classes need to start with a one-line documentation summary.
l) Same class
This is wrong and also this is supposed to be a documentation patch.
j) same class
"results to" should just be "is", and "Returned" should be "Value", to be consistent with $expr1.
l) Same class
Needs docs on the @return.
m)
Extra blank line needs to be removed.
n)
This should be a one-line summary.
o) SQLLite schema.php:
There should be a blank line before the @see.
Comment #22
chintan4u CreditAttribution: chintan4u commentedHi jhodgdon,
I have covered all point which are mentioned in #21.
--#21 point K) is not clear to me so removed those comments and just kept
there. I will need bit of help here.
--#21 point n) one-line summery goes beyond 80 columns.
Attaching patch & interdiff files. I would like to work further on this issue. So assigning this to myself.
Comment #24
chintan4u CreditAttribution: chintan4u commentedComment #25
jhodgdonThe point in #21-K is that the doc block immediately before a class declaration needs to document the class.
A doc block with @addtogroup must be separate from that. Use @ingroup if you just want to add the class to a topic.
See https://www.drupal.org/node/1354#defgroup
Anyway the latest patch doesn't apply, and someone still needs to review the accuracy of the SQLite stuff in it.
Comment #26
YesCT CreditAttribution: YesCT commentedI'm cleaning up some Novice tag duplicates. removing the combined "novice documentation" tag so I can delete it, since we should be able to make a search for the novice tag combined with the documentation tag https://www.drupal.org/project/issues/search?projects=&project_issue_fol... or maybe even better: the documentation component combined with the novice tag https://www.drupal.org/project/issues/search/drupal?project_issue_follow...
Comment #27
wheatpenny CreditAttribution: wheatpenny commentedAdding the beta evaluation.
Comment #28
deepakaryan1988Removing sprint weekend tag!!
As suggested by @YesCT
Comment #29
YesCT CreditAttribution: YesCT commented@deepakaryan1988 The tag was added January 17, 2015 during the actual global sprint weekend. See https://groups.drupal.org/node/447258
Please leave the tag on issues that were actually worked on during that event.
I think you might have confused a message from May about the sprint weekend tag, that it should not be added to events from May. The tag is for issues worked on during https://groups.drupal.org/node/447258 by people attending sprint weekend sprints.
Comment #30
neetu morwani CreditAttribution: neetu morwani as a volunteer commentedLast patch does not apply.
Comment #31
googletorp CreditAttribution: googletorp as a volunteer commentedRerolled patch
Comment #32
hussainwebI think #31 was meant to be for review?
Comment #33
jhodgdonThanks for the reroll!
I took a look through the latest patch. It looks pretty good, but not everything in it is an improvement. Some things to fix:
This new line of documentation needs to be wrapped in with the rest of this paragraph. Also:
id => ID
(two places)
If we're going to fix this line, why not fix it completely? The first word should be "Retrieves".
Could say
@return int
here it looks like? Our docs standards say that all docs should have @param/@return types, and this is new documentation, so it should have a type.
I think I would either say "index" or "INDEX" but not "Index" here?
End the line before a list in :
This needs to be:
This blank line should NOT be removed in this patch.
Um, is this actually returning SQL ? I think this is misleading. Why not just say that it returns $expr1 if $condition is TRUE, and $expr2 if not, rather than this "the generated SQL string", which tells me nothing?
I have no idea what this means. Can you rewrite these docs so they actually tell me what the function does and what the parameters mean?
Punctuation or grammar here is a bit off in the second sentence... I guess just remove the comma, or replace "that" with "which". But what is a "semi-private" method??? There is no such thing...
Most of the doc blocks in this class should I think just be @inheritdoc for the methods, rather than duplicating a base class or interface? This may apply to the others too. We can cut down on a lot of maintenance and duplication this way...
Comment #34
deepakaryan1988Taking this up.
Comment #35
deepakaryan1988Rerolling #31 patch with modification mentioned in #33
Comment #36
jhodgdonThanks, getting better!
From #33, the following still need attention:
item 1 - this is all one paragraph and it needs to be rewrapped:
item 5 - not fixed
item 6 - my suggestion had a typo, oops!
SQLite should not be SQLlite. Sorry about that!
#9 - not fixed. I still do not understand the documentation for this function.
#11 - not fixed. If you don't want to go back and change most everything in this patch to @inheritdoc, I can review the rest of the docs, but really it is WAY better to use @inheritdoc because then the docs are just in one place and if something needs to be changed it changes only once.
Comment #37
longwaveI think I fixed everything in #36, plus several new {@inheritdoc}s and fixes for a couple of other undocumented methods.
Comment #38
longwaveAdded a blank line by mistake in #37
Comment #39
jhodgdonThe interdiffs look probably OK... can someone else review this patch though? I am short of time. With all the new stuff this patch is getting very big and is also a moving target, because more keeps getting added. With @inheritdoc you really need to verify that the methods actually exist on a parent class/interface... takes significant time to review...
Comment #40
longwaveI identified all the inherited methods with PHPStorm and wrote new docblocks for the non-inherited ones. But, I can undo that if it would help move this forward quicker?
Comment #41
XanoThanks for taking this on! It's much-needed :)
emits must be
throws
.@param array
is too generic. It needs a more specific type (array[]
perhaps) and a description of the array structure or a reference to documentation elsewhere.Same here. This should be
string[]|array[]
Missing parameter type.
Missing parameter type.
Missing parameter type.
Yeah!
array
is too generic. It needs a more specific type, and preferably a description of the contents or a reference to documentation elsewhere.Missing parameter type.
Missing parameter type.
@param string[]|array[]
@param string[]|array[]
Needs more specific type.
Missing parameter type.
Missing parameter type.
If
NULL
is explicitly specified (it's already covered bymixed
), I'd expect the description to mention it has specific function?Not specific enough.
Not specific enough.
Not specific enough.
Not specific enough.
array[]
, and we should probably link to the schema documentation.array[]
, and we should probably link to the schema documentation.string[]|array[]
array[]
, and we should probably link to the schema documentation.Not specific enough.
Comment #42
jhodgdonComment #43
hussainwebRerolling first. Will work on comments in #41 once the tests pass.
Comment #44
hussainwebI fixed for the comments in #41 and many related issues I found in these files. I don't think it is done yet but I am posting this for an incremental review.
Comment #45
hussainwebOh, and the patch.
Comment #47
shipra.wasson CreditAttribution: shipra.wasson as a volunteer and commentedChecking the automatic assign credits feature.
Comment #48
shipra.wasson CreditAttribution: shipra.wasson as a volunteer and commentedComment #49
jhodgdonThis issue is too undefined, and the patch is too big (and too full of problems) to really be feasible to (a) review it and (b) ever get it to the point where it's free enough of problems to be able to commit it.
It is vastly preferable to have targeted issues, where one type of problem is fixed throughout core, rather than generic "fix up everything on a set of files" issues, where when you are reviewing it (or making the patch), you have to think about all of the rules, standards, and accuracy at the same time.
So. I don't think this was a good way to break up the parent issue. We need to break it up by type of fix, not by file.