Showing 70 of 76 total issues
Function execMicroStatements
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
execMicroStatements: function(statements, elem) {
_.each(statements, function(statement) {
// Register action handlers
if(statement.statement == 'on' && _.onClient()) {
var eName = statement.event;
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 serve
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
serve: function(expressApp, db) {
expressApp.post('/login', function(req, res) {
var users = db.collection('users');
users.findOne({_username: req.body.username}, function(err, user) {
if(!user || user._hash != sha256(req.body.password)) {
Function resolvePath
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
resolvePath: function(path, args) {
var self = this;
// Cut away the arguments part
// These are supplied by the evaluator already
path = path.split('(')[0];
Function Subscriber
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Subscriber = function() {
var subscribers = {};
// Listen for server-sent events
var evtSource = new EventSource('/events');
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 promises
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
var promises = _.compact(_.flatten(_.values(_.map(node.attributes, function(attr, key) {
// Dynamic attribute
if(attr.type == 'dynamic') {
var expr = attr.expression;
// Collect two way binding
Function Collection
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
var Collection = function(array) {
if(array && array.klass == 'Collection') return array;
var col = {
klass: 'Collection',
items: [],
- 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 openCursor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var openCursor = function(cb) {
var loadCollection = function(cbb) {
db.collection('pubsub', {strict: true}, function(err, pubsub) {
if(err) {
Function get
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
get: function(key) {
// Catch remaining arguments as parameters for computed properties
var args = Array.prototype.slice.call(arguments).splice(1);
// Determine value
var value = this.data.local[key];
Function prepareBundle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var prepareBundle = function(cb) {
if(bundle) return cb(bundle);
process.stdout.write("Preparing Bundle...");
// Use executed application as main script on the client as well
var appPath = process.argv[1];
Function subscribe
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var subscribe = function() {
if(modelOrCollection.klass == 'Model') {
if(_.onClient()) {
console.log("subscribe " + modelOrCollection.name);
modelOrCollection.app.pubSub.subscribe('create update delete', modelOrCollection.name, function(data) {
Function one
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
one: function(id, cb, raw) {
var ajax = function(cbb) {
_.ajax({url: url + '/' + id}).then(function(data) {
cbb(data);
}).catch(function() {
Avoid deeply nested control flow statements. Open
if(!attr.oneTimeOnly) {
attributePaths.push({
type: 'CSS',
klassName: klassName,
expr: expr,
Avoid deeply nested control flow statements. Open
if(elem.tagName == 'INPUT' && elem.type == 'number') {
value = parseFloat(value);
}
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
Avoid deeply nested control flow statements. Open
if(!newItems) newItems = _.clone(items.items);
Avoid deeply nested control flow statements. Open
if(_.last(expr) == '!') {
expr = expr.slice(0, -1);
save = true;
}
Function Evaluator
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var Evaluator = function(topNode, viewModels, parseTrees, interface, mainModel) {
Function DOMInterface
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var DOMInterface = function() {
return {
createFragment: function() {
return document.createDocumentFragment();
},
- 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"