codenautas/self-explain

View on GitHub

Showing 254 of 254 total issues

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

        ExportSpecifier: function (expr, precedence, flags) {
          var local = expr.local;
          var result = [local.name];
          var exported = expr.exported;
          if (exported && exported.name !== local.name) {
Severity: Major
Found in dist/escodegen.browser.js and 1 other location - About 3 hrs to fix
dist/escodegen.browser.js on lines 1929..1937

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 107.

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

              if (i > 0) {
                if (!stmt.body[i - 1].trailingComments && !stmt.body[i].leadingComments) {
                  generateBlankLines(stmt.body[i - 1].range[1], stmt.body[i].range[0], result);
                }
              }
Severity: Major
Found in dist/escodegen.browser.js and 1 other location - About 3 hrs to fix
dist/escodegen.browser.js on lines 909..913

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 99.

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

                if (i > 0) {
                  if (!stmt.body[i - 1].trailingComments && !stmt.body[i].leadingComments) {
                    generateBlankLines(stmt.body[i - 1].range[1], stmt.body[i].range[0], result);
                  }
                }
Severity: Major
Found in dist/escodegen.browser.js and 1 other location - About 3 hrs to fix
dist/escodegen.browser.js on lines 1448..1452

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 99.

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 assert has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

selfExplain.assert = function assert(value){
    if(value===true){
        return '';
    }
    return (function(stack){
Severity: Major
Found in lib/self-explain.js - About 3 hrs to fix

    Function attachComments has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          function attachComments(tree, providedComments, tokens) {
            var comments = [], comment, len, i, cursor;
            if (!tree.range) {
              throw new Error('attachComments needs range information');
            }
    Severity: Major
    Found in dist/escodegen.browser.js - About 3 hrs to fix

      Function SourceNode_toStringWithSourceMap has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
              var generated = {
                  code: '',
                  line: 1,
                  column: 0
      Severity: Major
      Found in dist/escodegen.browser.js - About 3 hrs to fix

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

              Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
                get: function () {
                  if (!this.__originalMappings) {
                    this.__generatedMappings = [];
                    this.__originalMappings = [];
        Severity: Major
        Found in dist/escodegen.browser.js and 1 other location - About 2 hrs to fix
        dist/escodegen.browser.js on lines 3357..3366

        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 92.

        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

              Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
                get: function () {
                  if (!this.__generatedMappings) {
                    this.__generatedMappings = [];
                    this.__originalMappings = [];
        Severity: Major
        Found in dist/escodegen.browser.js and 1 other location - About 2 hrs to fix
        dist/escodegen.browser.js on lines 3368..3377

        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 92.

        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 traverse has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              Controller.prototype.traverse = function traverse(root, visitor) {
                var worklist, leavelist, element, node, nodeType, ret, key, current, current2, candidates, candidate, sentinel;
                this.__initialize(root, visitor);
                sentinel = {};
                worklist = this.__worklist;
        Severity: Major
        Found in dist/escodegen.browser.js - About 2 hrs to fix

          Function BlockStatement has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  BlockStatement: function (stmt, flags) {
                    var range, content, result = [
                        '{',
                        newline
                      ], that = this;
          Severity: Major
          Found in dist/escodegen.browser.js - About 2 hrs to fix

            Function generate has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  function generate(node, options) {
                    var defaultOptions = getDefaultOptions(), result, pair;
                    if (options != null) {
                      if (typeof options.indent === 'string') {
                        defaultOptions.format.indent.style = options.indent;
            Severity: Major
            Found in dist/escodegen.browser.js - About 2 hrs to fix

              Function SourceNode_fromStringWithSourceMap has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
                      var node = new SourceNode;
                      var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
                      var shiftNextLine = function () {
                        var lineContents = remainingLines.shift();
              Severity: Major
              Found in dist/escodegen.browser.js - About 2 hrs to fix

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

                            if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
                              map.addMapping({
                                source: original.source,
                                original: {
                                  line: original.line,
                Severity: Major
                Found in dist/escodegen.browser.js and 1 other location - About 2 hrs to fix
                dist/escodegen.browser.js on lines 2485..2498

                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 82.

                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

                              } else if (sourceMappingActive) {
                                map.addMapping({
                                  source: original.source,
                                  original: {
                                    line: original.line,
                Severity: Major
                Found in dist/escodegen.browser.js and 1 other location - About 2 hrs to fix
                dist/escodegen.browser.js on lines 2449..2462

                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 82.

                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

                Consider simplifying this complex logical expression.
                Open

                        } else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
                          return;
                        } else {
                          throw new Error('Invalid mapping: ' + JSON.stringify({
                            generated: aGenerated,
                Severity: Critical
                Found in dist/escodegen.browser.js - About 2 hrs to fix

                  Function SourceMapConsumer_parseMappings has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
                          var generatedLine = 1;
                          var previousGeneratedColumn = 0;
                          var previousOriginalLine = 0;
                          var previousOriginalColumn = 0;
                  Severity: Major
                  Found in dist/escodegen.browser.js - About 2 hrs to fix

                    Function SourceMapGenerator_applySourceMap has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
                            var sourceFile = aSourceFile;
                            if (aSourceFile == null) {
                              if (aSourceMapConsumer.file == null) {
                                throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.');
                    Severity: Major
                    Found in dist/escodegen.browser.js - About 2 hrs to fix

                      Function ImportDeclaration has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              ImportDeclaration: function (stmt, flags) {
                                var result, cursor, that = this;
                                if (stmt.specifiers.length === 0) {
                                  return [
                                    'import',
                      Severity: Major
                      Found in dist/escodegen.browser.js - About 2 hrs to fix

                        Function separateParts has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function separateParts(previousResult, expressions){
                            var result={changes:false};
                            var newParts=[];
                            var registerNewNode=function(part){
                                // console.log('pre generate',part);
                        Severity: Major
                        Found in lib/self-explain.js - About 2 hrs to fix

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

                                      if (stmt.update) {
                                        result.push(space);
                                        result.push(that.generateExpression(stmt.update, Precedence.Sequence, E_TTT));
                                        result.push(')');
                                      } else {
                          Severity: Major
                          Found in dist/escodegen.browser.js and 1 other location - About 2 hrs to fix
                          dist/escodegen.browser.js on lines 1403..1409

                          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 77.

                          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