Giter Club home page Giter Club logo

Comments (14)

mbrevoort avatar mbrevoort commented on July 28, 2024

Same here. Ran it on two files, undefined reference bomb outs on both...


dox --debug < app.js

/usr/local/lib/node_modules/dox/lib/dox.js:44
comment.code = code = buf.trim();
^
TypeError: Cannot set property 'code' of undefined
at Object.parseComments (/usr/local/lib/node_modules/dox/lib/dox.js:44:22)
at [object Object]. (/usr/local/lib/node_modules/dox/bin/dox:40:17)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)


dox --debug < app-cluster.js

/usr/local/lib/node_modules/dox/lib/dox.js:70
comment.code = code;
^
TypeError: Cannot set property 'code' of undefined
at Object.parseComments (/usr/local/lib/node_modules/dox/lib/dox.js:70:18)
at [object Object]. (/usr/local/lib/node_modules/dox/bin/dox:40:17)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)

from dox.

agreco avatar agreco commented on July 28, 2024

I'm getting the same error but with version 0.1.1

from dox.

tj avatar tj commented on July 28, 2024

keep in mind the latest dox is a lot different, it's just a json representation of your docs now

from dox.

agreco avatar agreco commented on July 28, 2024

oh yeah totally, the same error is still occurring though

from dox.

agreco avatar agreco commented on July 28, 2024

here is an sample:

agreco:src agreco$ dox < env.js > env.json

/Users/agreco/local/node/lib/node_modules/dox/lib/dox.js:44
comment.code = code = buf.trim();
^
TypeError: Cannot set property 'code' of undefined
at Object.parseComments (/Users/agreco/local/node/lib/node_modules/dox/lib/dox.js:44:22)
at [object Object]. (/Users/agreco/local/node/lib/node_modules/dox/bin/dox:40:17)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)

I'm using node 0.4.12 for context

from dox.

tj avatar tj commented on July 28, 2024

ah, ok cool, i'll have to get more test-cases and fix any formatting im not covering

from dox.

tj avatar tj commented on July 28, 2024

ideally we'd use a "proper" javascript parser and just pluck out the comments etc, it's a nice hack currently

from dox.

agreco avatar agreco commented on July 28, 2024

cool cool, cheers mate

from dox.

TooTallNate avatar TooTallNate commented on July 28, 2024

This error happens when there's a JavaScript snippet without a comment block before it.

from dox.

nopnop avatar nopnop commented on July 28, 2024

Following code illustrate this bug :

// Copyright stuff

/**
 * My Comment
 */

I suggest not to take into account the buffer in this case :

dox.js :

  if (buf.trim().length) {
    comment = comments[comments.length - 1];
    if(comment) {
        comment.code = code = buf.trim();
        comment.ctx = exports.parseCodeContext(code);
    }
    buf = '';
  }

See https://github.com/nopnop/dox

from dox.

aredridel avatar aredridel commented on July 28, 2024

Wow. Misclick on my part there.

from dox.

it-ony avatar it-ony commented on July 28, 2024

This Issue is still exisiting, Merged fix isn't in current branch.
See https://github.com/visionmedia/dox/blob/master/lib/dox.js

from dox.

ForbesLindesay avatar ForbesLindesay commented on July 28, 2024

dox does now take the reasonable default of not including any code before the first comment, not sure if it's ideal, but probably good enough to close the issue? Or do we want the same behaviour as for a completely blank file, i.e. output a comment with no content to the comment and just the code + context?

from dox.

evindor avatar evindor commented on July 28, 2024

Seems to be outdated.

from dox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.