dlwin888 / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

Still getting WARNING: Trying to document ... #218

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. The following code:
/**
 * @class Class Name
 * @constructor
 * @ignore
 */
var myClass = function() {

    /** @lends myClass.prototype */
    return {

        /**
         * the name field
         */
        name : "",

        /**
         * hello function
         */
        hello : function () {
            this.name = "";
            this.hello2();
        },

        /**
         * hello2 function
         */
        hello2 : function () {

        }

    };
};
2.
3.

What is the expected output? What do you see instead?

Expecting no warnings.
Instead:
>> WARNING: Trying to document myClass#hello without first documenting 
myClass.
>> WARNING: Trying to document name as a member of undocumented symbol 
myClass.
>> WARNING: Trying to document hello as a member of undocumented symbol 
myClass.
>> WARNING: Trying to document hello2 as a member of undocumented symbol 
myClass.

What version of the product are you using? On what operating system?
2.1.0

Please provide any additional information below.

All except the first warning I can avoid by explicitly setting @private or 
@ignore on each function (would be nice if I didnt have to), however the 
first warning is caused by the this.name line and cant shake it no matter 
what I do.

I thought this was resolved some time back, back again?

Original issue reported on code.google.com by f0rcegr0...@gmail.com on 29 May 2009 at 11:02

GoogleCodeExporter commented 9 years ago
I dont know if it helps tracking the issue but looking at the code in Walker.js 
(which prints the warning) I realize that "this" is not recognized as a class 
instance (cause it correctly hasn't been documented?) but I still dont 
understand why 
a warning should be thrown in resolveThis function if it can't determine the 
parent. 
Also I think the warning message is misleading as it is not trying to document 
the 
function just identify the 'this' which in this case has no docs anyway...

I suppose some means of knowing that the parent is documented with the @ignore 
flag 
would help?

Original comment by f0rcegr0...@gmail.com on 29 May 2009 at 12:15

GoogleCodeExporter commented 9 years ago
The problem is that you are telling jsdtk to @ignore your myclass symbol, then 
you are trying to document 
members of that same myclass symbol. Remove the @ignore and the warnings should 
disappear. Conversely you 
can remove the doc comments from within the ignored class, and that will also 
silence the warnings (and you 
will get no docs for those symbols). But you can't have it both ways; you can't 
ignore the class and document all 
the members.

If you just want to use myclass a namespace (not a real constructor/class) use 
the @namespace tag.

Original comment by micmath on 15 Jun 2009 at 2:03

GoogleCodeExporter commented 9 years ago
How can I do if I want to  document a class and all it's members in the source 
but 
don't publish this class in pages?

If I can do this use a simple @private or @ignore tag will much help.

So I agree to this Issue

Original comment by kunhua...@gmail.com on 19 Nov 2009 at 12:57

GoogleCodeExporter commented 9 years ago
It isn't possible to document the members of a class without also documenting 
the class. On the other hand if 
the class is unimportant in your documentation you can tag it as a @namespace, 
which will simply collect all the 
members under that name. Of course you still need to add a doc comment to the 
class in order to mark it as a 
namespace.

Original comment by micmath on 21 Nov 2009 at 6:00

GoogleCodeExporter commented 9 years ago
I think the 1st point here is the message itself and how misleading it is and 
the 2nd point is the jsdtk inability to 
identify that 'this' has the @ignore tag.

The sample code is a demo only and a larger scale project is behind it. To be 
more specific we have classes named with 
underscore (_) to flag for obfuscation and code compacting some of which we 
would like to attach to a namespace. Hence, 
what we have is:

class _a {    

}

and

var company.com.className = _a;

In the above example we wish to document _a's methods and properties and assign 
the docs to the derived 
company.com.className link which has a different, more complete, name.

Possibly an bad architectural decision but I just wanted to help give the 
bigger picture.  

Original comment by f0rcegr0...@gmail.com on 30 Nov 2009 at 8:34

GoogleCodeExporter commented 9 years ago
PS: Note that the error is thrown at the 

this.name = "";

line of the original demo code and not on a method/prop.

Original comment by f0rcegr0...@gmail.com on 30 Nov 2009 at 8:37