This is a sub-issue of #1800046: [META] Add missing type hinting to core docblocks, fix Drupal.Commenting.FunctionComment.Missing* focused on correctly adding @param and @return type hinting to the Color module.
Documentation patches that include type hinting are time consuming to both review and commit because one must dig into the actual code to confirm that the type hints are both correct and complete. Hence, please be patient and try to limit type hint patches to covering only a limited number of docblocks (20-25 as a guess).
Related sprint issues:
Comment | File | Size | Author |
---|---|---|---|
#27 | interdiff.txt | 543 bytes | SV |
#27 | 1816760-27.patch | 2.45 KB | SV |
Comments
Comment #1
markhalliwell.
Comment #2
yanniboi CreditAttribution: yanniboi commentedThis is a first attempt at this issue. Mainly worked on /Drupal/color/Tests/ColorTest.php and a little in color.module.
Comment #3
valthebald@yanniboi: please follow the following standards:
Thank you!
Comment #4
yanniboi CreditAttribution: yanniboi commentedRerolled and removed line between @params.
Not entirely sure what you mean by:
I have been trying to follow the instructions here [#1312352], if I am still wrong, feel free to correct.
Comment #5
valthebald@yanniboi: I've reread instructions from [#1312352], please ignore my remark about @param description being on the same line.
Patch looks good for me now
Comment #6
webchickI'm not 100% sure of the standard here, so moving to "documentation" so jhodgdon can verify.
Comment #7
markhalliwellNo ; at the end.
Also, I don't believe "protected" should be here either.
Missing
$themes
.Missing
$colorTests
.Comment #8
markhalliwellFound a couple other things, here's a new patch.
Comment #9
markhalliwellAssigning back.
Comment #10
tim.plunkettWe don't include variable names in @var/@return, only @param
No docblock on getInfo()
Missing blank line
Comment #11
markhalliwellAddressed #10.1 and #10.2. #10.3 is actually a dreditor issue, it's ignoring lines that don't start with +/- and are "empty".
Comment #12
markhalliwellRemoved $modules
Comment #13
jhodgdonThe standards in this patch are OK, but the documentation is a bit questionable I think:
a) In Drupal 8, is this even accurate?
Shouldn't this be referencing a User class or interface?
b) Then the next chunk:
The docs say it is "the theme to be tested" but the @var says it is an array and the variable name is $themes, so I don't think the docs are accurate?
c)
So this is an array of colors? I don't think so. The colors are not even the array values, as you can see from this code that sets up this array:
A bit more explanation would be good.
d) And I'm guessing that
refers to the same type of array? "array of values to be tested" tells me really nothing.
e) Are we even doing inheritdoc on setUp() methods yet? I don't think that coding standard has been updated, and meanwhile, I think inheritdoc is supposed to be omitted?
Comment #14
aellison CreditAttribution: aellison commentedTaking a stab at cleaning up the documentation.
Comment #15
aellison CreditAttribution: aellison commentedTrying again.
Comment #16
jhodgdonThanks! This is getting closer.
A few things still to fix:
a) Please do not use @var object for Users objects. See
https://drupal.org/coding-standards/docs#types
It needs to be an interface type.
b)
The $test_values documentation... what kind of settings anyway? Saying "test settings for themes" doesn't really tell me anything.
c) In general, when saying something is an associative array, it's very helpful to explain what the keys and values are in the documentation. Just saying it's an array doesn't really document it very well. I would still need to go read the code to figure out what it is.
Comment #17
deimos CreditAttribution: deimos commentedI've make re-rolled patch with corrections above.
@jhodgdon, I am only doubt about point c). I took a look at other tests and I didn't see there explanation array structure of the variable or class property. Is it nessesary?
Comment #18
jhodgdonI would prefer that you either:
a) Add good documentation that actually explains what is going on.
or
b) If there is a function that you don't want to document or don't know how to document, simply do not make any changes to that function's documentation in your patch. Leave it for someone else to do later or leave it undocumented.
The thing is... programmers can always read the code to find out what is going on. They will read documentation if it is there, but if the documentation is incorrect or lacks useful information, it is just a waste of their time to have that documentation there, because they will read it and either be mislead or still just have to read the code if they want to know what is happening.
Thanks!
Comment #19
eojthebraveIt sounds like the line in question is this one?
An array of valid and invalid color values.
What if we change it to:
Associative array of hex color strings to test. Keys are the color string and values are a boolean set to TRUE for valid colors.
Comment #20
SV CreditAttribution: SV commentedAdded changes from previos comment for the variable $colorTests:
Comment #21
SV CreditAttribution: SV commentedRemoved trailing spaces from the comment for the variable $colorTests.
Comment #22
oleg chemerys CreditAttribution: oleg chemerys commentedI think new description makes much more sense.
Comment #23
jhodgdonOur docs standards require that the first line of any doc block be a one-line one-sentence description, followed by a blank line. So this is not OK:
Please separate after the first sentence.
Also, "Boolean" should technically be capitalized when it is used in a sentence, as opposed to "bool" when used as a data type in @var or @param or @return.
Thanks!
Comment #24
XanoAdding tag.
Comment #25
SV CreditAttribution: SV commentedSeparated sentences in the comment and fixed the typo of name.
Comment #26
jhodgdonLooks good!
This line exceeds 80 characters, can you please wrap it?
Comment #27
SV CreditAttribution: SV commentedYes, it's done.
Comment #29
jhodgdonThanks! That works. Committed to 8.x.
Comment #31
Mile23