Showing 41 of 71 total issues
File html_structure.js
has 542 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Template = require('../../lib/template');
var assertHtml = require('../helper').assertHtml;
describe('Html structure', function() {
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 mixin
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
VMProto.mixin = function() {
var name = arguments[0];
var lastArgument = arguments[arguments.length - 1];
if (typeof lastArgument === 'function') { // mixin definition
- 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 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 _merge
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
p._merge = function(names, values) {
var attrs = [];
for (var i = 0, il = names.length; i < il; i++) {
var name = names[i];
var value = values[name], delimiter = this._mergeAttrs[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 _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
File code_structure.js
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Template = require('../../lib/template');
var assertHtml = require('../helper').assertHtml;
describe('Code structure', function() {
var template;
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
File vm_node.js
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Template = require('../lib/template');
var FS = require('fs');
describe('VMNode', function() {
var fixture = {};
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 mixin
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
VMProto.mixin = function() {
var name = arguments[0];
var lastArgument = arguments[arguments.length - 1];
if (typeof lastArgument === 'function') { // mixin definition
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 assertHtml
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.assertHtml = function(template, src, result, options) {
if (Array.isArray(src)) {
src = src.join('\n');
}
Function escape
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function escape(str) {
if (typeof str !== 'string') {
if (!str) {
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 on_html_doctype
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
p.on_html_doctype = function(exps) {
var type = exps[2];
var html = '<!DOCTYPE html>';
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 _merge
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
p._merge = function(names, values) {
var attrs = [];
for (var i = 0, il = names.length; i < il; i++) {
var name = names[i];
var value = values[name], delimiter = this._mergeAttrs[name];