File parser.js
has 515 lines of code (exceeds 250 allowed). Consider refactoring. Open
var attrDelimRe = /^\s*([\(\)\[\]])/;
var blockExpressionRe = /^\s*:\s*/;
var closedTagRe = /^\s*\/\s*/;
var delimRe = /^[\(\[]/;
var doctypeRe = /^doctype\b/i;
Function _parseTag
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
p._parseTag = function(tag) {
var m, trailingWS, leadingWS;
if (tagShortcut[tag]) {
tag = tagShortcut[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 _parseTextBlock
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
p._parseTextBlock = function(firstLine, textIndent, inTag) {
var result = ['multi'];
if (!firstLine || !firstLine.length) {
textIndent = null;
- 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 _parseJSCode
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
p._parseJSCode = function(outerDelimeter) {
var code = '', count = 0, delimiter, closeDelimiter, m;
// Attribute ends with space or attribute delimiter
var endRe = new RegExp('^[\\s' + this._escapeRegExp(outerDelimeter) + ']');
- 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 _parseTag
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
p._parseTag = function(tag) {
var m, trailingWS, leadingWS;
if (tagShortcut[tag]) {
tag = tagShortcut[tag];
}
Function _parseAttributes
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
p._parseAttributes = function(attributes) {
// Check to see if there is a delimiter right after the tag name
var delimiter, m;
m = attrDelimRe.exec(this._line);
- 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 _parseAttributes
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
p._parseAttributes = function(attributes) {
// Check to see if there is a delimiter right after the tag name
var delimiter, m;
m = attrDelimRe.exec(this._line);
Function _parseQuotedAttribute
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
p._parseQuotedAttribute = function(quote) {
var value = '', count = 0;
while (count !== 0 || this._line[0] !== quote) {
var m = /^(\\)?$/.exec(this._line);
- 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
Consider simplifying this complex logical expression. Open
if (
// HTML comment
this._matchLineThen(htmlCommentRe, _parseHtmlComment) ||
// or HTML conditional comment
this._matchLineThen(htmlConditionalCommentRe, _parseHtmlConditionalComment) ||
Function _parseTextBlock
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
p._parseTextBlock = function(firstLine, textIndent, inTag) {
var result = ['multi'];
if (!firstLine || !firstLine.length) {
textIndent = null;
Function _parseLine
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
p._parseLine = function() {
if (emptyLineRe.test(this._line)) {
this._pushOnTop(['newline']);
return;
}
- 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 _parseJSCode
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
p._parseJSCode = function(outerDelimeter) {
var code = '', count = 0, delimiter, closeDelimiter, m;
// Attribute ends with space or attribute delimiter
var endRe = new RegExp('^[\\s' + this._escapeRegExp(outerDelimeter) + ']');
Function _parseLine
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
p._parseLine = function() {
if (emptyLineRe.test(this._line)) {
this._pushOnTop(['newline']);
return;
}
Function _parseCommentBlock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var _parseCommentBlock = function(parser) {
while (parser._lines.length) {
if (!emptyLineRe.test(parser._lines[0])) {
var indent = parser._getIndent(parser._lines[0]);
if (indent <= parser._indents._last()) {
- 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"