src/compiler/parser/html-parser.js

Summary

Maintainability
F
5 days
Test Coverage

Function parseHTML has a Cognitive Complexity of 162 (exceeds 5 allowed). Consider refactoring.
Open

export function parseHTML (html, options) {
  const stack = []
  const expectHTML = options.expectHTML
  const isUnaryTag = options.isUnaryTag || no
  const canBeLeftOpenTag = options.canBeLeftOpenTag || no
Severity: Minor
Found in src/compiler/parser/html-parser.js - About 3 days 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 parseHTML has 214 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function parseHTML (html, options) {
  const stack = []
  const expectHTML = options.expectHTML
  const isUnaryTag = options.isUnaryTag || no
  const canBeLeftOpenTag = options.canBeLeftOpenTag || no
Severity: Major
Found in src/compiler/parser/html-parser.js - About 1 day to fix

    Function parseEndTag has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function parseEndTag (tagName, start, end) {
        let pos, lowerCasedTagName
        if (start == null) start = index
        if (end == null) end = index
    
    
    Severity: Minor
    Found in src/compiler/parser/html-parser.js - About 1 hr to fix

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

        function handleStartTag (match) {
          const tagName = match.tagName
          const unarySlash = match.unarySlash
      
          if (expectHTML) {
      Severity: Minor
      Found in src/compiler/parser/html-parser.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                  if (commentEnd >= 0) {
                    if (options.shouldKeepComment) {
                      options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3)
                    }
                    advance(commentEnd + 3)
        Severity: Major
        Found in src/compiler/parser/html-parser.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if (conditionalEnd >= 0) {
                      advance(conditionalEnd + 2)
                      continue
                    }
          Severity: Major
          Found in src/compiler/parser/html-parser.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
                        advance(1)
                      }
            Severity: Major
            Found in src/compiler/parser/html-parser.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if (next < 0) break
              Severity: Major
              Found in src/compiler/parser/html-parser.js - About 45 mins to fix

                There are no issues that match your filters.

                Category
                Status