codenautas/self-explain

View on GitHub

Showing 254 of 254 total issues

Function ObjectPattern has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        ObjectPattern: function (expr, precedence, flags) {
          var result, i, iz, multiline, property, that = this;
          if (!expr.properties.length) {
            return '{}';
          }
Severity: Minor
Found in dist/escodegen.browser.js - About 1 hr to fix

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

            BreakStatement: function (stmt, flags) {
              if (stmt.label) {
                return 'break ' + stmt.label.name + this.semicolon(flags);
              }
              return 'break' + this.semicolon(flags);
    Severity: Major
    Found in dist/escodegen.browser.js and 1 other location - About 1 hr to fix
    dist/escodegen.browser.js on lines 951..956

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

    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

            ContinueStatement: function (stmt, flags) {
              if (stmt.label) {
                return 'continue ' + stmt.label.name + this.semicolon(flags);
              }
              return 'continue' + this.semicolon(flags);
    Severity: Major
    Found in dist/escodegen.browser.js and 1 other location - About 1 hr to fix
    dist/escodegen.browser.js on lines 945..950

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

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

          function getDefaultOptions() {
            return {
              indent: null,
              base: null,
              parse: null,
    Severity: Minor
    Found in dist/escodegen.browser.js - About 1 hr to fix

      Function generateRegExp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function generateRegExp(reg) {
              var match, result, flags, i, iz, ch, characterInBrack, previousIsBackslash;
              result = reg.toString();
              if (reg.source) {
                match = result.match(/\/([^\/]*)$/);
      Severity: Minor
      Found in dist/escodegen.browser.js - About 1 hr to fix

        Function normalize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              function normalize(aPath) {
                var path = aPath;
                var url = urlParse(aPath);
                if (url) {
                  if (!url.path) {
        Severity: Minor
        Found in dist/escodegen.browser.js - About 1 hr to fix

          Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(config) {
            config.set({
          
              // base path that will be used to resolve all patterns (eg. files, exclude)
              basePath: '',
          Severity: Minor
          Found in karma.conf.js - About 1 hr to fix

            Function SourceMapGenerator_fromSourceMap has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
                    var sourceRoot = aSourceMapConsumer.sourceRoot;
                    var generator = new SourceMapGenerator({
                        file: aSourceMapConsumer.file,
                        sourceRoot: sourceRoot
            Severity: Minor
            Found in dist/escodegen.browser.js - About 1 hr to fix

              Function runFactory has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    function runFactory(id, deps, factory) {
                      var r, e, m, result;
                      if (id) {
                        e = loaderCache[id] = {};
                        m = {
              Severity: Minor
              Found in dist/escodegen.browser.js - About 1 hr to fix

                Function ArrayExpression has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        ArrayExpression: function (expr, precedence, flags, isPattern) {
                          var result, multiline, that = this;
                          if (!expr.elements.length) {
                            return '[]';
                          }
                Severity: Minor
                Found in dist/escodegen.browser.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                            if (fragment.charCodeAt(0) === 123 || isClassPrefixed(fragment) || isFunctionPrefixed(fragment) || isAsyncPrefixed(fragment) || directive && flags & F_DIRECTIVE_CTX && stmt.expression.type === Syntax.Literal && typeof stmt.expression.value === 'string') {
                              result = [
                                '(',
                                result,
                                ')' + this.semicolon(flags)
                  Severity: Critical
                  Found in dist/escodegen.browser.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
                              return;
                            } 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 {
                    Severity: Critical
                    Found in dist/escodegen.browser.js - About 1 hr to fix

                      Function ComprehensionExpression has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              ComprehensionExpression: function (expr, precedence, flags) {
                                var result, i, iz, fragment, that = this;
                                result = expr.type === Syntax.GeneratorExpression ? ['('] : ['['];
                                if (extra.moz.comprehensionExpressionStartsWithAssignment) {
                                  fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
                      Severity: Minor
                      Found in dist/escodegen.browser.js - About 1 hr to fix

                        Function escapeString has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              function escapeString(str) {
                                var result = '', i, len, code, singleQuotes = 0, doubleQuotes = 0, single, quote;
                                for (i = 0, len = str.length; i < len; ++i) {
                                  code = str.charCodeAt(i);
                                  if (code === 39) {
                        Severity: Minor
                        Found in dist/escodegen.browser.js - About 1 hr to fix

                          Function generateFunctionParams has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                CodeGenerator.prototype.generateFunctionParams = function (node) {
                                  var i, iz, result, hasDefault;
                                  hasDefault = false;
                                  if (node.type === Syntax.ArrowFunctionExpression && !node.rest && (!node.defaults || node.defaults.length === 0) && node.params.length === 1 && node.params[0].type === Syntax.Identifier) {
                                    result = [
                          Severity: Minor
                          Found in dist/escodegen.browser.js - About 1 hr to fix

                            Function SwitchCase has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    SwitchCase: function (stmt, flags) {
                                      var result, fragment, i, iz, bodyFlags, that = this;
                                      withIndent(function () {
                                        if (stmt.test) {
                                          result = [
                            Severity: Minor
                            Found in dist/escodegen.browser.js - About 1 hr to fix

                              Function IndexedSourceMapConsumer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    function IndexedSourceMapConsumer(aSourceMap) {
                                      var sourceMap = aSourceMap;
                                      if (typeof aSourceMap === 'string') {
                                        sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
                                      }
                              Severity: Minor
                              Found in dist/escodegen.browser.js - About 1 hr to fix

                                Function BinaryExpression has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        BinaryExpression: function (expr, precedence, flags) {
                                          var result, currentPrecedence, fragment, leftSource;
                                          currentPrecedence = BinaryPrecedence[expr.operator];
                                          if (currentPrecedence < precedence) {
                                            flags |= F_ALLOW_IN;
                                Severity: Minor
                                Found in dist/escodegen.browser.js - About 1 hr to fix

                                  Function adjustMultilineComment has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        function adjustMultilineComment(value, specialBase) {
                                          var array, i, len, line, j, spaces, previousBase, sn;
                                          array = value.split(/\r\n|[\r\n]/);
                                          spaces = Number.MAX_VALUE;
                                          for (i = 1, len = array.length; i < len; ++i) {
                                  Severity: Minor
                                  Found in dist/escodegen.browser.js - About 1 hr to fix

                                    Function ForStatement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            ForStatement: function (stmt, flags) {
                                              var result, that = this;
                                              withIndent(function () {
                                                result = ['for' + space + '('];
                                                if (stmt.init) {
                                    Severity: Minor
                                    Found in dist/escodegen.browser.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language