syntheticore/declaire

View on GitHub

Showing 76 of 76 total issues

Function create has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    create: function(args, elem, cb) {
      var inst = model.create();
      
      // Remove persistance related methods
      delete inst.save;
Severity: Minor
Found in src/viewModel.js - About 1 hr to fix

    Function serialize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            serialize: function() {
              var html = '';
              if(!this.topSerialized) {
                // Begin tag
                if(!this._fragment) {
    Severity: Minor
    Found in src/serverStreamInterface.js - About 1 hr to fix

      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 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 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 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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      for(var key in ref.queries) {
                        var query = ref.queries[key].clone();
                        inst.data.remote[key] = query;
                      }
                Severity: Major
                Found in src/model.js and 1 other location - About 1 hr to fix
                src/model.js on lines 353..356

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      for(var key in ref.collections) {
                        var collection = ref.collections[key].clone();
                        inst.data.remote[key] = collection;
                      }
                Severity: Major
                Found in src/model.js and 1 other location - About 1 hr to fix
                src/model.js on lines 358..361

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                            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(!attr.oneTimeOnly) {
                                              attributePaths.push({
                                                type: 'CSS',
                                                klassName: klassName,
                                                expr: expr,
                              Severity: Major
                              Found in src/evaluator.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language