syntheticore/declaire

View on GitHub

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;
Severity: Minor
Found in src/evaluator.js - About 1 hr to fix

    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+(.+)}}/)) {
    Severity: Minor
    Found in src/parser.js - About 1 hr to fix

    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)) {
    Severity: Minor
    Found in src/serverAuth.js - About 1 hr to fix

      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];
      Severity: Minor
      Found in src/scope.js - About 1 hr to fix

        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');
        Severity: Minor
        Found in src/clientSubscriber.js - About 1 hr to fix

          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') {
          Severity: Minor
          Found in src/parser.js - About 1 hr to fix

          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
          Severity: Minor
          Found in src/evaluator.js - About 1 hr to fix

            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: [],
            Severity: Minor
            Found in src/collection.js - About 1 hr to fix

            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) {
            Severity: Minor
            Found in src/serverPublisher.js - About 1 hr to fix

              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];
              Severity: Minor
              Found in src/model.js - About 1 hr to fix

                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];
                Severity: Minor
                Found in src/serverApplication.js - About 1 hr to fix

                  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) {
                  Severity: Minor
                  Found in src/query.js - About 1 hr to fix

                    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() {
                    Severity: Minor
                    Found in src/clientDataInterface.js - About 1 hr to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    if(!attr.oneTimeOnly) {
                                      attributePaths.push({
                                        type: 'CSS',
                                        klassName: klassName,
                                        expr: expr,
                      Severity: Major
                      Found in src/evaluator.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                          if(elem.tagName == 'INPUT' && elem.type == 'number') {
                                            value = parseFloat(value);
                                          }
                        Severity: Major
                        Found in src/evaluator.js - About 45 mins to fix

                          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';
                          Severity: Minor
                          Found in src/parser.js - About 45 mins to fix

                          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);
                          Severity: Major
                          Found in src/evaluator.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                          if(_.last(expr) == '!') {
                                            expr = expr.slice(0, -1);
                                            save = true;
                                          }
                            Severity: Major
                            Found in src/evaluator.js - About 45 mins to fix

                              Function Evaluator has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              var Evaluator = function(topNode, viewModels, parseTrees, interface, mainModel) {
                              Severity: Minor
                              Found in src/evaluator.js - About 35 mins to fix

                                Function DOMInterface has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                var DOMInterface = function() {
                                  return {
                                    createFragment: function() {
                                      return document.createDocumentFragment();
                                    },
                                Severity: Minor
                                Found in src/clientDOMInterface.js - About 35 mins to fix

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language