Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError with missing braces and multi-line description in @returns tag #185

Open
pabigot opened this issue Dec 27, 2015 · 1 comment

Comments

@pabigot
Copy link

pabigot commented Dec 27, 2015

Reproduced with node-jscs, but from the stack trace I think the issue lies here.

The following source code:

/**
 * Description.
 *
 * @param {integer} v - value v
 *
 * @param {integer} w - value w
 *
 * @returns string - `v`
 * plus `w` as a string
 */
function f(v, w) {
  return (v + w).toString(16);
}

when processed with a .jscsrc holding:

{
  "preset": "google"
}

produces for me:

Error running rule jsDoc: This is an issue with JSCS and not your codebase.
Please file an issue (with the stack trace below) at: https://github.com/jscs-dev/node-jscs/issues/new
AssertionError: Unable to add an error, `column` should be a positive number but -1 given
    at Object.Errors._validateInput (/tmp/foo/node_modules/jscs/lib/errors.js:73:9)
    at Object.Errors.add (/tmp/foo/node_modules/jscs/lib/errors.js:46:14)
    at addError (/tmp/foo/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:166:28)
    at /tmp/foo/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:181:25
    at Object.requireReturnTypes (/tmp/foo/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc/require-return-types.js:17:9)
    at /tmp/foo/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:145:27
    at Array.forEach (native)
    at DocComment.<anonymous> (/tmp/foo/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:144:46)
    at Array.forEach (native)
    at DocComment.forEachTag [as iterate] (/tmp/foo/node_modules/jscs/node_modules/jscs-jsdoc/lib/jsdoc.js:86:19) at lib/foo.js :
     1 |/**
--------^
     2 | * Description.
     3 | *


1 code style error found.

Putting the missing braces around the type in the @returns statement fixes this, as does joining the two lines of the @returns description into one line, if that helps track down the origin of the problem.

@qfox
Copy link
Member

qfox commented Jan 10, 2016

Thanks for report. Looking at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants