Code Monkey home page Code Monkey logo

Comments (8)

nikhilkalige avatar nikhilkalige commented on July 20, 2024

This is the output i get when i run.
Can you please be more specific and point out the error, gif or screenshot would be helpful

/**
 * [get_function_return_type description]
 * @param  {[type]} name   [description]
 * @param  {[type]} retval [description]
 * @return {[type]}        [description]
 */
DocsParser.prototype.get_function_return_type = function(name, retval) {
    return 123;
};

from docblockr.

emflores avatar emflores commented on July 20, 2024

I am having the same issue, and seem to have narrowed down the problem. Both function expressions and declarations do not get a return value in the doc block if the name contains a capital letter.

This gets a return value in the doc block:

var a = function () {
   return;
};

This doesn't:

var A = function () {
   return;
};

This doesn't either:

var aA = function () {
   return;
};

from docblockr.

chriscollinsboxuk avatar chriscollinsboxuk commented on July 20, 2024

I'm getting the same issue in PHP:

Lower-case method name:

    /**
     * [dosomething description]
     *
     * @param [type] $xray [description]
     * @param array $yankee [description]
     * @param [type] $zulu [description]
     *
     * @return [type] [description]
     */
    public function dosomething($xray, array $yankee = array(), $zulu)
    {
        return 1;
    }

Method name containing an upper-case character:

    /**
     * [doSomething description]
     *
     * @param [type] $xray [description]
     * @param array $yankee [description]
     * @param [type] $zulu [description]
     */
    public function doSomething($xray, array $yankee = array(), $zulu)
    {
        return 1;
    }

from docblockr.

curtisblackwell avatar curtisblackwell commented on July 20, 2024

I'm getting the exact same results as @chriscollinsboxuk in PHP.

from docblockr.

jgonagle avatar jgonagle commented on July 20, 2024

Ditto, in JS.

from docblockr.

robtarr avatar robtarr commented on July 20, 2024

The offending method is DocsParser.prototype.get_function_return_type: https://github.com/NikhilKalige/docblockr/blob/master/lib/docsparser.js#L202

It's trying to infer a return type.

if(name.search(/[A-Z]/) > -1)
        return null;  // no return, but should add a class

is the statement causing it to fail.

Anybody have any thoughts on what this method should actually be checking for?

from docblockr.

bryanbraun avatar bryanbraun commented on July 20, 2024

From the README:

In Javascript, if the function begins with an uppercase letter then it is assumed that the function is a class definition. No @return tag is added.

search() returns the index of the first match, so if set our condition to only match for the 0th index then it won't trigger for caps throughout the function name. This should fix it:

- if(name.search(/[A-Z]/) > -1)
+ if(name.search(/[A-Z]/) === 0)

PR here: #91

from docblockr.

malko avatar malko commented on July 20, 2024

merged for next release thx

from docblockr.

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.