mlessio/js-docgen

View on GitHub

Showing 19 of 19 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  promise.then(function(data){
    var inferredType = null;
    if(data.type.indexOf('->') !== -1)
      inferredType = data.type.split('->')[1].trim().split('|');
    else if(commentObject.returns === true)
Severity: Major
Found in lib/jsdocgen.js and 1 other location - About 5 hrs to fix
lib/jsdocgen.js on lines 96..105

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 145.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  promise.then(function(data){
    var inferredType = null;
    if(data.type.indexOf('->') !== -1)
      inferredType = data.type.split('->')[1].trim().split('|');
    else if(commentObject.returns === true)
Severity: Major
Found in lib/jsdocgen.js and 1 other location - About 5 hrs to fix
lib/jsdocgen.js on lines 121..130

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 145.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if(this.tTypes && this.tTypes.length > 0){
    commentString += '@throws {' + this.tTypes.join('|') + '}';
    commentString += '\n * ';
  }
Severity: Major
Found in lib/comment.js and 1 other location - About 1 hr to fix
lib/comment.js on lines 27..30

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if(this.rTypes && this.rTypes.length > 0){
    commentString += '@return {' + this.rTypes.join('|') + '}';
    commentString += '\n * '
  }
Severity: Major
Found in lib/comment.js and 1 other location - About 1 hr to fix
lib/comment.js on lines 31..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

          getType('test', 4, 4, function(err, data){
            if(err){
              console.error('Err!', err);
              return;
            }
          Severity: Major
          Found in ternTest.js and 3 other locations - About 40 mins to fix
          ternTest.js on lines 50..56
          ternTest.js on lines 58..64
          ternTest.js on lines 66..72

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

          getType('test', 6, 14, function(err, data){
            if(err){
              console.error('Err!', err);
              return;
            }
          Severity: Major
          Found in ternTest.js and 3 other locations - About 40 mins to fix
          ternTest.js on lines 42..48
          ternTest.js on lines 50..56
          ternTest.js on lines 66..72

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

          getType('test', 13, 5, function(err, data){
            if(err){
              console.error('Err!', err);
              return;
            }
          Severity: Major
          Found in ternTest.js and 3 other locations - About 40 mins to fix
          ternTest.js on lines 42..48
          ternTest.js on lines 50..56
          ternTest.js on lines 58..64

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

          getType('test', 0, 13, function(err, data){
            if(err){
              console.error('Err!', err);
              return;
            }
          Severity: Major
          Found in ternTest.js and 3 other locations - About 40 mins to fix
          ternTest.js on lines 42..48
          ternTest.js on lines 58..64
          ternTest.js on lines 66..72

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          var ternServerConfig = {
            switchToDoc: function(name) { self.selectDoc(self.findDoc(name)) },
            useWorker: false
          };
          Severity: Minor
          Found in ternTest.js and 1 other location - About 30 mins to fix
          lib/inferrer.js on lines 5..8

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            var ternServerConfig = {
              switchToDoc: function(name) { self.selectDoc(self.findDoc(name)) },
              useWorker: false
            };
          Severity: Minor
          Found in lib/inferrer.js and 1 other location - About 30 mins to fix
          ternTest.js on lines 14..17

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language