Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
22 May 2015 at 18:47 UTC
Updated:
22 Jun 2015 at 03:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
nod_Comment #2
nod_Some more 80 char limit and method summary fixes.
Comment #3
nod_Reroll
Comment #4
wim leersHoly shit.
Comment #5
wim leersThis is such a monumental task, such a big undertaking, that IMHO it'd be fine to commit this patch as-is and then iteratively improve from there. It only touches comments. And it's a big step forward already anyway.
I read the entire thing, and have a few nitpicks, but mostly general questions.
s/Ckeditor/CKEditor/
s/Ckeditor/CKEditor/
It's not really a JS API, it's just an implementation of the
Drupal.editorsAPI!These should all basically be
{@inheritdoc}, if that is possible?s/Ckeditor/CKEditor/
s/sylecombo/StylesCombo/
No closing tag?
Aha, so it exists? :)
What do the square brackets here mean?
Why is it
Arraywith a capital, but aobjectwithout?Woah, what?
If we have
@inheritdoc, then why are these additional things necessary?"Attaches" & "Detaches". We always use 3rd person singular.
Comment #6
jhodgdonWim: thanks for reviewing, which I haven't made time for yet, sorry!
One note: in JSDoc, @inheritdoc means "Inherit the all the parent docs". See #1337022-12: [policy, no patch] Create/adopt JavaScript docs standards compatible with a JS documentation parser for a summary of what inheritdoc means for various docs parsers.... Our usage for PHP is like this too.
Anyway, in JSDoc I do not think you can use @inheritdoc and then add other docs. According to JSDoc docs, it shouldn't work right.
Comment #7
nod_Quickly on the inherit doc thing. We have inherit doc all over the place but we inherit from Backbone.Model, or Backbone.View and those things do not have JSDoc documentation. So we're essentially inheriting nothing. Also had to add those because of eslint rasing a warning on those "undocumented" parameters. I'll reply/reroll the rest later.
Comment #8
wim leersRE: Backbone + JSDoc: they wontfixed it: https://github.com/jashkenas/backbone/issues/2203 — :(
Comment #9
jhodgdonI would not recommend using @inheritdoc unless there is actually doc to inherit. And I still do not think that "@inheritdoc + more" is supported in JSDoc.
Comment #10
nod_1,2,4 fixed.
3, there is no parent (it's a namespace), nothing to inherit from. Or you'll have to change the code which I won't do here.
5, no, it's how it's done. example ends when next tag starts or when end of docblock is reached.
6, yep, and it works if the parent exists and is properly documented: http://read.theodoreb.net/drupal-jsapi/Drupal.quickedit.editors.form.html
7, optional parameter.
8, phpstorm doesn't like lowercase Array. I know it's a lame justification but it's just a search/replace fix. Bigger fish and all.
9, that's how you say your object has keys that are strings and values that are Drupal.FilterStatus objects.
10, because of eslint & phpstorm. Eslint show a warning and phpstorm doesn't display types (bug on both of them I know) @jhodgdon: all the extra stuff is ignored by jsdoc, as the doc says. See http://read.theodoreb.net/drupal-jsapi/Drupal.quickedit.editors.form.html it's same docs as http://read.theodoreb.net/drupal-jsapi/Drupal.quickedit.EditorView.html
11, fixed.
Comment #11
jhodgdonI looked at the beginning of this patch, which is way too long for a quick review... sorry...
A few questions and ideas:
what's "drupalimage"? If it's a name of a class or variable or something, maybe instead of making this separate words, just use the real name of the class/whatever? As it is, it's not really English or code speak.
See like this, this is good, because I immediately know that Drupal.editors is a code thing.
Need docs on all these.
No description here for the first line, or for the param/returns?
Um. This isn't really docs?
Is the ? here correct?
Comment #12
nod_1. name of the ckeditor plugin.
2. agreed.
3. Only this docblock or you'll make me fix all of them one at a time? Because that's the third docblock on the page and there are many more like it below.
4. With documentation like that I'll get picked up by JSDoc and will at least show up in the documentation.
5. Hey at least it's clear a string isn't expected in here.
6. Yes, it's JSDoc way to say a variable can be "null", in this case it happens to be it's default value.
Comment #13
nod_@link stuff.
Comment #14
dawehnerDoes it make sense to say at least {Array.
}? Did not managed to look more into that particular patchComment #15
eiriksmWoah, OK, so second 200K patch review on one day. I am pretty sure I did not get everything, but here is a couple nitpicks. As the other issue, this is probably ready to go, but these small things, since I saw them, could be fixed first, no?
Also, for the record. As far as I could tell, only comments were added / edited, no code was touched. This is a non-disruptive patch in that way.
OK, so my small points:
Ideally we would use @callback here I guess. But this first spree would probably spawn plenty of these
81 characters.
I was wondering if you were doing any of these. I guess there will be quite some follow-ups on @listens tags. But OK. Just an observation :)
Did not research this, but if we had an example to put in as a @see comment, that would be nice. This is a nitpick and could also be its own little issue I guess.
Seems like some reformatting for 80 chars gone wrong :)
@example on its own line, caption tag on the following?
Same as above
...and again
Awesome, there is one of those (mentioned above). There is probably a lot more of those not in your patches (I think I spotted a couple), but that's for other issues.
I don't get why you changed this. Seems this line used to be 80 chars, but you pushed one word onto a new line, making that the only word on that line?
another instance of "one word on one line"
...and here
Super extreme nitpick here, but this should probably use sentence case.
New line after @example?
Again, this is awesome work @nod_!
Comment #16
ashutoshsngh commentedComment #17
ashutoshsngh commentedComment #18
shamsher_alam commentedComment #19
shamsher_alam commentedComment #20
nod_Sorry your patch had PHP in it. This is a JS-only patch. Also with a patch this size an interdiff is required, otherwise it's impossible to know what's going on.
(edit) The interdiff is between #13 and this patch.
Comment #21
dawehnerAll the feedback from @eiriksm got adressed
Comment #22
jhodgdonThanks for the patches/reviews!
Follow-ups that I noticed, besides the generic "fill this in better":
core/modules/editor/js/editor.admin.js:
- Needs attention for line wrapping/formatting
- Lots of doc blocks have paragraphs of description but lack a one-line summary at the start
- Does JSDoc support numbered lists? I know that the API module doesn't, so comments like:
will not format correctly. Should check the JSDoc output and see if this works. Probably this one would actually be better as a bullet list anyway, because it's not really ordered information. (This is in the docs for Drupal.FilterHTMLRule by the way).
core/modules/editor/js/editor.js
- There seem to be a number of doc blocks without the @constructor, @type, or other indication of what exactly they are. Possibly I'm wrong about this, but I thought you had to put something in the doc block to tell JSDoc what is being documented, or it wouldn't pick it up?
- I noticed @prop there, which I guess is a legal synonym of @property for JSDoc. But I think elsewhere in the JS codebase we're using @property. It would be nice to pick one and standardize I think within Drupal, as much as possible?
Generically:
I find it really confusing to see something like this:
The function parameters are from, to, and context. The lines like @param context.reason are telling us about properties of the context object. Is this really the standard way to do that? It seems very very very odd to me.
In PHP land, we'd do something like this:
Anyway... Committed as-is to 8.0.x. Thanks everyone for the patches and reviews!
Comment #24
eiriksmWohoo!
It is the standard, yes. Also, personally I find it better, expecially the output when you are documenting like that. The above example outputs this, for example:
This tells me (in the same way it describes the parameters) that the object consists of those properties, with those types.
Granted, it is not ideal that this is not the same as the php way, and also, I guess this is somewhat a matter of taste as well.
Anyway, great work to everyone involved, and especially @nod_! :)
Comment #25
jhodgdonGood enough! We should not try to shoehorn JS into PHP standards necessarily, and as long as JSDoc is happy that is good enough. Thanks for the explanation.