npm/marky-markdown

View on GitHub

Showing 51 of 65 total issues

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 getParser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

render.getParser = function (options) {
  var mdOptions = {
    html: true,
    langPrefix: 'highlight ',
    linkify: options.linkify
Severity: Minor
Found in lib/render.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

Avoid too many return statements within this function.
Open

    if (typeof state.env.references === 'undefined') { return false }
Severity: Major
Found in lib/gfm/image.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return true
    Severity: Major
    Found in lib/plugin/html-heading.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return false
      Severity: Major
      Found in lib/gfm/link.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return true
        Severity: Major
        Found in lib/gfm/image.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return true
          Severity: Major
          Found in lib/gfm/link.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return result
            Severity: Major
            Found in lib/gfm/override-link-destination-parser.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  if (!end) { return false }
              Severity: Major
              Found in lib/plugin/html-heading.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return false
                Severity: Major
                Found in lib/gfm/image.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return false
                  Severity: Major
                  Found in lib/gfm/image.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language