Function parseStatement
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseStatement: function(line) {
var m;
var out;
// if
if(m = line.match(/{{if\s+(.+)}}/)) {
File parser.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
var _ = require('./utils.js');
// Breadth-first walk the tree in reverse order
var inverseBreadth = function(node, cb) {
Function parseTemplate
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseTemplate: function(tmpl) {
var self = this;
var lines = tmpl.split('\n');
var lastIndent = 0;
var lineNum = 0;
Function parseTag
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseTag: function(line) {
var self = this;
var m = line.match(/(([\w-#\.]+\s*>\s*)*)([\w-]+)?(#([\w-]+))?((\.[\w-]+)*)(\((.*)\))?(\+)?( (.*))?/);
var multiTags = m[1];
var tag = m[3] || 'div';
Function parseStatement
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
parseStatement: function(line) {
var m;
var out;
// if
if(m = line.match(/{{if\s+(.+)}}/)) {
- 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 cleanTree
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
var cleanTree = function(node) {
if(node.children) {
for(var i = node.children.length - 1; i >= 0; i--) {
var child = node.children[i];
if(child.type == 'Alternative') {
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
parseTag: function(line) {
var self = this;
var m = line.match(/(([\w-#\.]+\s*>\s*)*)([\w-]+)?(#([\w-]+))?((\.[\w-]+)*)(\((.*)\))?(\+)?( (.*))?/);
var multiTags = m[1];
var tag = m[3] || 'div';
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
parseAttribute: function(str) {
var attr = {type: 'static', value: str};
// Dynamic attribute
if(str[0] == '{') {
// Trim off curlies
- 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"