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.
- Read upRead up
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
- Read upRead up
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.
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 '[':
- Read upRead up
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
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)
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
- Read upRead up
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)) {
- Read upRead up
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)
- Read upRead up
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) {
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
- Read upRead up
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)) {
- Read upRead up
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) {
- Read upRead up
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)
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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"