Showing 16 of 20 total issues

Function skipRegex has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

export default function skipRegex(code, start) {
  let pos = (RE_DOT_CHAR.lastIndex = start++)

  // `exec()` will extract from the slash to the end of the line
  //   and the chained `match()` will match the possible regex.
Severity: Minor
Found in src/utils/skip-regex.js - About 4 hrs 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 openTag has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  openTag(store, node) {
    const name = node.name
    const attrs = node.attributes
    const isCoreTag =
      (JAVASCRIPT_TAG === name && !hasSrcAttribute(node)) || name === STYLE_TAG
Severity: Minor
Found in src/tree-builder.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 skipRegex has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function skipRegex(code, start) {
  let pos = (RE_DOT_CHAR.lastIndex = start++)

  // `exec()` will extract from the slash to the end of the line
  //   and the chained `match()` will match the possible regex.
Severity: Minor
Found in src/utils/skip-regex.js - About 1 hr to fix

    Function updateStack has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function updateStack(stack, char, idx, code) {
      let index = 0
    
      switch (char) {
        case '[':
    Severity: Minor
    Found in src/utils/expr-extr.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 openTag has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      openTag(store, node) {
        const name = node.name
        const attrs = node.attributes
        const isCoreTag =
          (JAVASCRIPT_TAG === name && !hasSrcAttribute(node)) || name === STYLE_TAG
    Severity: Minor
    Found in src/tree-builder.js - About 1 hr to fix

      Function attr has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function attr(state) {
        const { data, last, pos, root } = state
        const tag = last // the last (current) tag in the output
        const _CH = /\S/g // matches the first non-space char
        const ch = execFromPos(_CH, pos, data)
      Severity: Minor
      Found in src/parsers/attribute.js - About 1 hr to fix

        Function parseExpressions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function parseExpressions(state, re) {
          const { data, options } = state
          const { brackets } = options
          const expressions = []
          let unescape, pos, match
        Severity: Minor
        Found in src/parsers/expression.js - About 55 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 parseNomalAttribute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function parseNomalAttribute(state, attr, quote) {
          const { data } = state
          let { end } = attr
        
          if (isBoolAttribute(attr.name)) {
        Severity: Minor
        Found in src/parsers/attribute.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 exprExtr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function exprExtr(code, start, bp) {
          const [openingBraces, closingBraces] = bp
          const offset = start + openingBraces.length // skips the opening brace
          const stack = [] // expected closing braces ('`' for ES6 TL)
          const re = _regex(closingBraces)
        Severity: Minor
        Found in src/utils/expr-extr.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 parseAttribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function parseAttribute(state, match, start, end, isExpressionName) {
        Severity: Minor
        Found in src/parsers/attribute.js - About 35 mins to fix

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

          export default function pushText(state, start, end, extra = {}) {
            const text = getChunk(state.data, start, end)
            const expressions = extra.expressions
            const unescape = extra.unescape
          
          
          Severity: Minor
          Found in src/utils/push-text.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 pushTag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function pushTag(state, name, start, end) {
            const root = state.root
            const last = { type: TAG, name, start, end }
          
            if (isCustom(name)) {
          Severity: Minor
          Found in src/utils/push-tag.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 _regex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function _regex(b) {
            let re = reBr[b]
            if (!re) {
              let s = escapeStr(b)
              if (b.length > 1) {
          Severity: Minor
          Found in src/utils/expr-extr.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 attr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function attr(state) {
            const { data, last, pos, root } = state
            const tag = last // the last (current) tag in the output
            const _CH = /\S/g // matches the first non-space char
            const ch = execFromPos(_CH, pos, data)
          Severity: Minor
          Found in src/parsers/attribute.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 skipES6TL has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function skipES6TL(code, pos, stack) {
            // we are in the char following the backquote (`),
            // find the next unescaped backquote or the sequence "${"
            const re = /[`$\\]/g
            let c
          Severity: Minor
          Found in src/utils/skip-es6-tl.js - About 25 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 expr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function expr(state, node, endingChars, start) {
            const re = b0re(state, endingChars)
          
            re.lastIndex = start // reset re position
          
          
          Severity: Minor
          Found in src/parsers/expression.js - About 25 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