betajs/betajs-data

View on GitHub

Showing 182 of 182 total issues

Function save has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            save: function(transaction_id) {
                if (this.isRemoved())
                    return Promise.create({});
                var promise = this.option("save_invalid") ? Promise.value(true) : this.validate();
                return promise.mapSuccess(function(valid) {
Severity: Major
Found in src/modelling/models.js - About 2 hrs to fix

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

                _iterate_ic: function(key, direction, callback, context) {
                    TreeMap.iterate_from(key, this._ignoreCaseMap, function(iterKey, value) {
                        for (var id in value) {
                            if (callback.call(context, iterKey, id) === false)
                                return false;
    Severity: Major
    Found in src/data/indices/memory_index.js and 1 other location - About 2 hrs to fix
    src/data/indices/memory_index.js on lines 62..70

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

    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

                _iterate: function(key, direction, callback, context) {
                    TreeMap.iterate_from(key, this._exactMap, function(iterKey, value) {
                        for (var id in value) {
                            if (callback.call(context, iterKey, id) === false)
                                return false;
    Severity: Major
    Found in src/data/indices/memory_index.js and 1 other location - About 2 hrs to fix
    src/data/indices/memory_index.js on lines 72..80

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

    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

                serialize: function (data) {
                    return this._preSerialize(data).mapSuccess(function (data) {
                        return this.__store.serialize(data).mapSuccess(function (data) {
                            return this._postSerialize(data);
                        }, this);
    Severity: Major
    Found in src/data/stores/delegators/passthrough_store.js and 1 other location - About 2 hrs to fix
    src/data/stores/delegators/passthrough_store.js on lines 74..80

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

    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

                unserialize: function (data) {
                    return this._preUnserialize(data).mapSuccess(function (data) {
                        return this.__store.unserialize(data).mapSuccess(function (data) {
                            return this._postUnserialize(data);
                        }, this);
    Severity: Major
    Found in src/data/stores/delegators/passthrough_store.js and 1 other location - About 2 hrs to fix
    src/data/stores/delegators/passthrough_store.js on lines 82..88

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

    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 cacheGet has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                cacheGet: function (id, options, ctx) {
                    var foreignKey = options.foreignKey && this._foreignKey;
                    return this.cacheOnlyGet(id, options, ctx).mapSuccess(function (data) {
                        if (!data) {
                            if (!foreignKey && this._foreignKey)
    Severity: Major
    Found in src/data/stores/partial/cached_store.js - About 2 hrs to fix

      Function sourceUpdate has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  sourceUpdate: function (row, data, dummy_ctx, pre_data, transaction_id) {
                      return this.criticalSection("commit", function () {
                          this.commitId++;
                          var row_id = Types.is_object(row) ? row[this._options.source_id_key] : row;
                          var target_type = "update";
      Severity: Minor
      Found in src/data/stores/base/store_history.js - About 1 hr to fix

        Function __update has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    __update: function(constrainedQuery) {
                        var hasQuery = !!constrainedQuery.query;
                        constrainedQuery = Constrained.rectify(constrainedQuery);
                        var currentSkip = this._query.options.skip || 0;
                        var currentLimit = this._query.options.limit || null;
        Severity: Minor
        Found in src/collections/abstract_query_collection.js - About 1 hr to fix

          Function disjunctiveNormalForm has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  disjunctiveNormalForm: function(query, mergeKeys) {
                      query = Objs.clone(query, 1);
                      var factors = [];
                      if (query.$or) {
                          var factor = [];
          Severity: Minor
          Found in src/data/queries/queries.js - About 1 hr to fix

            Function compileQuery has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    compileQuery: function(constrainedQuery, constrainedQueryCapabilities, constrainedQueryFunction, constrainedQueryContext) {
                        constrainedQuery = Constrained.rectify(constrainedQuery);
                        var sorting_supported = Constrained.sortValidate(constrainedQuery.options, constrainedQueryCapabilities);
                        var query_supported = Queries.validate(constrainedQuery.query, constrainedQueryCapabilities.query || {});
                        var skip_supported = Constrained.skipValidate(constrainedQuery.options, constrainedQueryCapabilities);
            Severity: Minor
            Found in src/data/queries/query_engine.js - About 1 hr to fix

              Function poll has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          poll: function () {
                              if (!this.__ignoreUpdates) {
                                  Objs.iter(this.__itemCache, function (cached, id) {
                                      this._store.get(id, cached.context).success(function (data) {
                                          if (!data)
              Severity: Minor
              Found in src/data/stores/watchers/poll_watcher.js - About 1 hr to fix

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

                            constructor: function (storeInvokee, options) {
                                inherited.constructor.call(this);
                                this.__storeInvokee = storeInvokee;
                                this.__options = Objs.tree_extend({
                                    dataMap: {
                Severity: Minor
                Found in src/data/stores/invokers/rest_invokers.js - About 1 hr to fix

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

                              constructor: function (restInvokee, options) {
                                  inherited.constructor.call(this);
                                  this.__restInvokee = restInvokee;
                                  this.__options = Objs.tree_extend({
                                      methodMap: {
                  Severity: Minor
                  Found in src/data/stores/invokers/rest_invokers.js - About 1 hr to fix

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

                                        return (new MappedIterator(results, function(data) {
                                            data[this.id_key()] = data[this.table().primary_key()];
                                            delete data[this.table().primary_key()];
                                            return data;
                                        }, this)).auto_destroy(results, true);
                    Severity: Major
                    Found in src/data/databases/database_store.js and 1 other location - About 1 hr to fix
                    src/data/databases/database_store.js on lines 57..61

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

                    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

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

                                    return this.__map_ids ? promise.mapSuccess(function(data) {
                                        data[this.id_key()] = data[this.table().primary_key()];
                                        delete data[this.table().primary_key()];
                                        return data;
                                    }, this) : promise;
                    Severity: Major
                    Found in src/data/databases/database_store.js and 1 other location - About 1 hr to fix
                    src/data/databases/database_store.js on lines 72..76

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

                    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 mergeConditions has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            mergeConditions: function(conditions1, conditions2) {
                                if (!Types.is_object(conditions1))
                                    conditions1 = {
                                        "$eq": conditions1
                                    };
                    Severity: Minor
                    Found in src/data/queries/queries.js - About 1 hr to fix

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

                                  itemIterateIc: function(key, direction, callback, context) {
                                      this.iterate_ic(key, direction, function(iterKey, id) {
                                          return callback.call(context, iterKey, this._store.get(id).value());
                                      }, this);
                                  },
                      Severity: Major
                      Found in src/data/indices/abstract_index.js and 1 other location - About 1 hr to fix
                      src/data/indices/abstract_index.js on lines 72..76

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

                      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

                                  itemIterate: function(key, direction, callback, context) {
                                      this.iterate(key, direction, function(iterKey, id) {
                                          return callback.call(context, iterKey, this._store.get(id).value());
                                      }, this);
                                  },
                      Severity: Major
                      Found in src/data/indices/abstract_index.js and 1 other location - About 1 hr to fix
                      src/data/indices/abstract_index.js on lines 82..86

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

                      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 constructor has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  constructor: function(store, model_type, options) {
                                      inherited.constructor.call(this);
                                      this.__store = store;
                                      this.__model_type = model_type;
                                      this.__options = Objs.extend({
                      Severity: Minor
                      Found in src/modelling/tables.js - About 1 hr to fix

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

                                        return this._update(id, data, ctx, transaction_id).success(function (row) {
                                            this._updated(Objs.extend(Objs.objectBy(this._id_key, id), row), data, ctx, undefined, transaction_id);
                                        }, this);
                        Severity: Major
                        Found in src/data/stores/base/write_store.js and 1 other location - About 1 hr to fix
                        src/data/stores/base/write_store.js on lines 125..127

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language