npm/marky-markdown

View on GitHub

Showing 51 of 65 total issues

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

var headings = module.exports = function (md, options) {
  var headingAnchorClass = options.headingAnchorClass || 'anchor'
  var headingSvgClass = options.headingSvgClass || ['octicon', 'octicon-link']
  var iconClasses = [].concat(headingSvgClass).join(' ')
  // shamelessly borrowed from GitHub, thanks y'all
Severity: Minor
Found in lib/plugin/heading-links.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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

var marky = module.exports = function (markdown, options) {
  var html

  if (typeof markdown !== 'string') {
    throw Error('first argument must be a string')
Severity: Minor
Found in index.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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

var plugin = module.exports = function (md, options) {
  // monkey patch the 'fence' parsing rule to restore markdown-it's pre-5.1 behavior
  // (see https://github.com/markdown-it/markdown-it/issues/190)
  var stockFenceRule = md.renderer.rules.fence
  md.renderer.rules.fence = function (tokens, idx, options, env, slf) {
Severity: Minor
Found in lib/plugin/code-wrap.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 heading_open has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  md.renderer.rules.heading_open = function (tokens, idx, options, env, self) {
Severity: Minor
Found in lib/plugin/packagize.js - About 35 mins to fix

    Function fence has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      md.renderer.rules.fence = function (tokens, idx, options, env, slf) {
    Severity: Minor
    Found in lib/plugin/language-alias.js - About 35 mins to fix

      Function fence has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        md.renderer.rules.fence = function (tokens, idx, options, env, slf) {
      Severity: Minor
      Found in lib/plugin/code-wrap.js - About 35 mins to fix

        Function image has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          md.renderer.rules.image = function (tokens, idx, options, env, self) {
        Severity: Minor
        Found in lib/plugin/github.js - About 35 mins to fix

          Function paragraph_open has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            md.renderer.rules.paragraph_open = function (tokens, idx, options, env, self) {
          Severity: Minor
          Found in lib/plugin/packagize.js - About 35 mins to fix

            Function html_block has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              md.renderer.rules.html_block = function (tokens, idx, options, env, self) {
            Severity: Minor
            Found in lib/plugin/youtube.js - About 35 mins to fix

              Function html_inline has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                md.renderer.rules.html_inline = function (tokens, idx, options, env, self) {
              Severity: Minor
              Found in lib/plugin/youtube.js - About 35 mins to fix

                Function link_open has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  md.renderer.rules.link_open = function handleLink (tokens, idx, options, env, self) {
                Severity: Minor
                Found in lib/plugin/nofollow.js - About 35 mins to fix

                  Function image has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    md.renderer.rules.image = function (tokens, idx, options, env, self) {
                  Severity: Minor
                  Found in lib/plugin/cdn.js - About 35 mins to fix

                    Function replaceTagAttribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function replaceTagAttribute (html, tag, attribute, buildUrl, repository) {
                    Severity: Minor
                    Found in lib/plugin/github.js - About 35 mins to fix

                      Function defaultRender has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        var defaultRender = md.renderer.rules.link_open || function (tokens, idx, options, env, self) {
                      Severity: Minor
                      Found in lib/plugin/nofollow.js - About 35 mins to fix

                        Function link_open has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
                        Severity: Minor
                        Found in lib/plugin/github.js - About 35 mins to fix

                          Function image has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            md.renderer.rules.image = function (tokens, idx, options, env, self) {
                          Severity: Minor
                          Found in lib/plugin/gravatar.js - About 35 mins to fix

                            Function heading_open has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              md.renderer.rules.heading_open = function (tokens, idx, opts, env, self) {
                            Severity: Minor
                            Found in lib/plugin/heading-links.js - About 35 mins to fix

                              Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                              module.exports = function (md, opts) {
                                if (!opts) return
                                if (!opts.package) return
                                if (!opts.package.name) return
                                if (!opts.package.version) return
                              Severity: Minor
                              Found in lib/plugin/cdn.js - About 35 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 replaceTagAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function replaceTagAttribute (html, tag, attribute, buildUrl, repository) {
                                // look for the attribute's value
                                var regex = new RegExp('<\\s*' + tag + '[^>]*\\b' + attribute + '\\s*=\\s*', 'i')
                                var attr = html.match(regex)
                                if (attr) {
                              Severity: Minor
                              Found in lib/plugin/github.js - About 35 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 isYoutubeIframe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function isYoutubeIframe (content) {
                                // look for the src attribute's value
                                var attr = content.match(/<\s*iframe[^>]*\bsrc\s*=\s*/)
                                if (attr) {
                                  // mark the location and figure out what kind of quotation mark is delimiting the value
                              Severity: Minor
                              Found in lib/plugin/youtube.js - About 35 mins to fix

                              Cognitive Complexity

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

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

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

                              Further reading

                              Severity
                              Category
                              Status
                              Source
                              Language