socketstream/socketstream

View on GitHub
docs/js/marked.js

Summary

Maintainability
F
1 wk
Test Coverage

File marked.js has 815 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * marked - a markdown parser
 * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 */
Severity: Major
Found in docs/js/marked.js - About 1 day to fix

    Function token has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Lexer.prototype.token = function(src, top) {
      var src = src.replace(/^ +$/gm, '')
        , next
        , loose
        , cap
    Severity: Major
    Found in docs/js/marked.js - About 1 day to fix

      Function tok has 129 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Parser.prototype.tok = function() {
        switch (this.token.type) {
          case 'space': {
            return '';
          }
      Severity: Major
      Found in docs/js/marked.js - About 5 hrs to fix

        Function output has 112 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        InlineLexer.prototype.output = function(src) {
          var out = ''
            , link
            , text
            , href
        Severity: Major
        Found in docs/js/marked.js - About 4 hrs to fix

          Function marked has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function marked(src, opt, callback) {
            if (callback || typeof opt === 'function') {
              if (!callback) {
                callback = opt;
                opt = null;
          Severity: Major
          Found in docs/js/marked.js - About 2 hrs to fix

            Avoid deeply nested control flow statements.
            Open

                      if (!loose) loose = next;
            Severity: Major
            Found in docs/js/marked.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if (bull !== b && !(bull.length > 1 && b.length > 1)) {
                          src = cap.slice(i + 1).join('\n') + src;
                          i = l - 1;
                        }
              Severity: Major
              Found in docs/js/marked.js - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                      return '<p>'
                        + this.parseText()
                        + '</p>\n';
                Severity: Major
                Found in docs/js/marked.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return '<table>\n'
                          + body
                          + '</table>\n';
                  Severity: Major
                  Found in docs/js/marked.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return '<'
                            + type
                            + '>\n'
                            + body
                            + '</'
                    Severity: Major
                    Found in docs/js/marked.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return '<li>'
                              + body
                              + '</li>\n';
                      Severity: Major
                      Found in docs/js/marked.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return '<blockquote>\n'
                                + body
                                + '</blockquote>\n';
                        Severity: Major
                        Found in docs/js/marked.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return '<p>'
                                  + this.inline.output(this.token.text)
                                  + '</p>\n';
                          Severity: Major
                          Found in docs/js/marked.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return '<li>'
                                    + body
                                    + '</li>\n';
                            Severity: Major
                            Found in docs/js/marked.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return !this.token.pre && !this.options.pedantic
                                      ? this.inline.output(this.token.text)
                                      : this.token.text;
                              Severity: Major
                              Found in docs/js/marked.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return Parser.parse(Lexer.lex(src, opt), opt);
                                Severity: Major
                                Found in docs/js/marked.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                        return '<p>An error occured:</p><pre>'
                                          + escape(e.message + '', true)
                                          + '</pre>';
                                  Severity: Major
                                  Found in docs/js/marked.js - About 30 mins to fix

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

                                          for (i = 0; i < item.align.length; i++) {
                                            if (/^ *-+: *$/.test(item.align[i])) {
                                              item.align[i] = 'right';
                                            } else if (/^ *:-+: *$/.test(item.align[i])) {
                                              item.align[i] = 'center';
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 6 hrs to fix
                                    docs/js/marked.js on lines 382..392

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

                                    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

                                          for (i = 0; i < item.align.length; i++) {
                                            if (/^ *-+: *$/.test(item.align[i])) {
                                              item.align[i] = 'right';
                                            } else if (/^ *:-+: *$/.test(item.align[i])) {
                                              item.align[i] = 'center';
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 6 hrs to fix
                                    docs/js/marked.js on lines 211..221

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

                                    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

                                          item = {
                                            type: 'table',
                                            header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
                                            align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
                                            cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 2 hrs to fix
                                    docs/js/marked.js on lines 204..209

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

                                    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

                                          item = {
                                            type: 'table',
                                            header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
                                            align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
                                            cells: cap[3].replace(/\n$/, '').split('\n')
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 2 hrs to fix
                                    docs/js/marked.js on lines 375..380

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

                                    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 (cap = this.rules.em.exec(src)) {
                                          src = src.substring(cap[0].length);
                                          out += '<em>'
                                            + this.output(cap[2] || cap[1])
                                            + '</em>';
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 2 hrs to fix
                                    docs/js/marked.js on lines 634..640

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

                                    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 (cap = this.rules.strong.exec(src)) {
                                          src = src.substring(cap[0].length);
                                          out += '<strong>'
                                            + this.output(cap[2] || cap[1])
                                            + '</strong>';
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 2 hrs to fix
                                    docs/js/marked.js on lines 643..649

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

                                    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

                                        case 'loose_item_start': {
                                          var body = '';
                                    
                                          while (this.next().type !== 'list_item_end') {
                                            body += this.tok();
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 1 hr to fix
                                    docs/js/marked.js on lines 905..915

                                    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

                                            body += this.token.align[i]
                                              ? '<th align="' + this.token.align[i] + '">' + heading + '</th>\n'
                                              : '<th>' + heading + '</th>\n';
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 1 hr to fix
                                    docs/js/marked.js on lines 893..895

                                    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

                                              body += this.token.align[j]
                                                ? '<td align="' + this.token.align[j] + '">' + cell + '</td>\n'
                                                : '<td>' + cell + '</td>\n';
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 1 hr to fix
                                    docs/js/marked.js on lines 880..882

                                    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

                                        case 'blockquote_start': {
                                          var body = '';
                                    
                                          while (this.next().type !== 'blockquote_end') {
                                            body += this.tok();
                                    Severity: Major
                                    Found in docs/js/marked.js and 1 other location - About 1 hr to fix
                                    docs/js/marked.js on lines 945..955

                                    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.options.gfm) {
                                        if (this.options.tables) {
                                          this.rules = block.tables;
                                        } else {
                                          this.rules = block.gfm;
                                    Severity: Minor
                                    Found in docs/js/marked.js and 1 other location - About 55 mins to fix
                                    docs/js/marked.js on lines 521..529

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

                                    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.options.gfm) {
                                        if (this.options.breaks) {
                                          this.rules = inline.breaks;
                                        } else {
                                          this.rules = inline.gfm;
                                    Severity: Minor
                                    Found in docs/js/marked.js and 1 other location - About 55 mins to fix
                                    docs/js/marked.js on lines 100..106

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status