mlessio/js-docgen

View on GitHub

Showing 9 of 19 total issues

Function inferThrows has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function inferThrows(fun, commentObj, fileName){

  traverse(fun, {pre: function(node, parent, prop, idx) {
      // console.log(node.type + (parent ? " from parent " + parent.type +
      //     " via " + prop + (idx !== undefined ? "[" + idx + "]" : "") : ""));
Severity: Minor
Found in lib/jsdocgen.js - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function inferThrows has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function inferThrows(fun, commentObj, fileName){

  traverse(fun, {pre: function(node, parent, prop, idx) {
      // console.log(node.type + (parent ? " from parent " + parent.type +
      //     " via " + prop + (idx !== undefined ? "[" + idx + "]" : "") : ""));
Severity: Minor
Found in lib/jsdocgen.js - About 1 hr to fix

    Function doesItThrow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    ASTParser.prototype.doesItThrow = function(fun){
      var tTypes = [];
      traverse(fun, {pre: function(node, parent, prop, idx) {
          // console.log(node.type + (parent ? " from parent " + parent.type +
          //     " via " + prop + (idx !== undefined ? "[" + idx + "]" : "") : ""));
    Severity: Minor
    Found in lib/parser.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function generateComment has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function generateComment(fun, fileName){
      var comment = new Comment();
    
      if(fun.id)
        comment.name = fun.id.name;
    Severity: Minor
    Found in lib/jsdocgen.js - About 1 hr to fix

      Function annotate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      JSDocGen.prototype.annotate = function(fileName, fileData){
      
        if(!inferencePromises[fileName])
          inferencePromises[fileName] = [];
      
      
      Severity: Minor
      Found in lib/jsdocgen.js - About 1 hr to fix

        Function pre has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          traverse(fun, {pre: function(node, parent, prop, idx) {
              // console.log(node.type + (parent ? " from parent " + parent.type +
              //     " via " + prop + (idx !== undefined ? "[" + idx + "]" : "") : ""));
              if(node.type === 'TryStatement' || (node.type !== 'CatchClause' && parent && parent.catching)){
                node.catching = true;
        Severity: Minor
        Found in lib/jsdocgen.js - About 1 hr to fix

          Function annotate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          JSDocGen.prototype.annotate = function(fileName, fileData){
          
            if(!inferencePromises[fileName])
              inferencePromises[fileName] = [];
          
          
          Severity: Minor
          Found in lib/jsdocgen.js - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function toString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          Comment.prototype.toString = function(){
            var commentString = '*\n * ';
            commentString += this.name;
            commentString += '\n * ';
            for(let p of this.params){
          Severity: Minor
          Found in lib/comment.js - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function doesItReturn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          ASTParser.prototype.doesItReturn = function(fun){
            var rTypes = [];
            traverse(fun, {pre: function(node, parent, prop, idx) {
                // console.log(node.type + (parent ? " from parent " + parent.type +
                //     " via " + prop + (idx !== undefined ? "[" + idx + "]" : "") : ""));
          Severity: Minor
          Found in lib/parser.js - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language