betajs/betajs-data

View on GitHub

Showing 182 of 182 total issues

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

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

                    if (conditions["$gte" + add] && (gt === null || compare(gt, conditions["$gte" + add]) < 0)) {
                        gte = true;
                        gt = conditions["$gte" + add];
                    }
Severity: Major
Found in src/data/queries/queries.js and 1 other location - About 1 hr to fix
src/data/queries/queries.js on lines 540..543

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

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, pre_data_filtered, 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 130..132

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

Function sourceRemove has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            sourceRemove: function (id, data) {
                return this.criticalSection("commit", function () {
                    this.commitId++;
                    var cont = Promise.create();
                    if (this._options.combine_insert_remove) {
Severity: Minor
Found in src/data/stores/base/store_history.js - About 1 hr to fix

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

                            if (options.accessMeta) {
                                meta.accessMeta = this.cacheStrategy.itemAccessMeta(meta.accessMeta);
                                this.itemCache.update(cached_id, this.addItemMeta({}, meta), ctx);
                            }
    Severity: Major
    Found in src/data/stores/partial/cached_store.js and 1 other location - About 1 hr to fix
    src/data/stores/partial/cached_store.js on lines 349..352

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

    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

                                if (options.queryAccessMeta) {
                                    meta.accessMeta = this.cacheStrategy.queryAccessMeta(meta.accessMeta);
                                    this.queryCache.update(query_id, this.addQueryMeta({}, meta), ctx);
                                }
    Severity: Major
    Found in src/data/stores/partial/cached_store.js and 1 other location - About 1 hr to fix
    src/data/stores/partial/cached_store.js on lines 276..279

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

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

                cacheUpdate: function (id, data, options, ctx, transaction_id) {
                    var foreignKey = options.foreignKey && this._foreignKey;
                    var idKey = foreignKey ? this.remoteStore.id_key() : this.id_key();
                    var itemPromise = foreignKey ?
                                      this.itemCache.getBy(this.remoteStore.id_key(), id, ctx)
    Severity: Minor
    Found in src/data/stores/partial/cached_store.js - About 1 hr to fix

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

                          (oldItemValue || []).forEach(function(key) {
                              if (result[key]) {
                                  delete result[key][item.cid()];
                                  if (Types.is_empty(result[key]))
                                      delete result[key];
      Severity: Major
      Found in src/modelling/grouped.js and 1 other location - About 1 hr to fix
      src/modelling/grouped.js on lines 228..234

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

      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

                          if (this._options.delete_cascade) {
                              this._model.registerHook("remove", function(result) {
                                  return this.removeAll().mapSuccess(function() {
                                      return result;
                                  });
      Severity: Major
      Found in src/modelling/associations/has_many_associations.js and 1 other location - About 1 hr to fix
      src/modelling/associations/one_associations.js on lines 16..22

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

      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

                          if (this._options.delete_cascade) {
                              this._model.registerHook("remove", function(result) {
                                  return this.remove().mapSuccess(function() {
                                      return result;
                                  });
      Severity: Major
      Found in src/modelling/associations/one_associations.js and 1 other location - About 1 hr to fix
      src/modelling/associations/has_many_associations.js on lines 22..28

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

      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

                          itemValue.forEach(function(key) {
                              if (result[key]) {
                                  delete result[key][item.cid()];
                                  if (Types.is_empty(result[key]))
                                      delete result[key];
      Severity: Major
      Found in src/modelling/grouped.js and 1 other location - About 1 hr to fix
      src/modelling/grouped.js on lines 239..245

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

      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

                  itemRefreshMeta: function (refreshMeta) {
                      if (refreshMeta)
                          return refreshMeta;
                      if (this._options.itemRefreshTime === null)
                          return null;
      Severity: Major
      Found in src/data/stores/partial/cached_store.js and 1 other location - About 1 hr to fix
      src/data/stores/partial/cached_store.js on lines 583..589

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

      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

                  queryRefreshMeta: function (refreshMeta) {
                      if (refreshMeta)
                          return refreshMeta;
                      if (this._options.queryRefreshTime === null)
                          return null;
      Severity: Major
      Found in src/data/stores/partial/cached_store.js and 1 other location - About 1 hr to fix
      src/data/stores/partial/cached_store.js on lines 575..581

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

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

              simplifyConditions: function(conditions) {
                  var result = {};
                  Objs.iter(["", "ic"], function(add) {
                      if (conditions["$eq" + add] || conditions["$in" + add]) {
                          var filtered = Objs.filter(conditions["$eq" + add] ? [conditions["$eq" + add]] : conditions["$in" + add], function(inkey) {
      Severity: Minor
      Found in src/data/queries/queries.js - About 1 hr to fix

        Function indexQueryConditionsSize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                indexQueryConditionsSize: function(conds, index, ignoreCase) {
                    var postfix = ignoreCase ? "_ic" : "";
                    var info = index.info();
                    var subSize = info.row_count;
                    var rows_per_key = info.row_count / Math.max(info["key_count" + postfix], 1);
        Severity: Minor
        Found in src/data/queries/query_engine.js - About 1 hr to fix

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

                      constructor: function (remoteStore, options) {
                          inherited.constructor.call(this);
                          this.remoteStore = remoteStore;
                          this.__remoteQueryAggregate = Promise.aggregateExecution(this.remoteStore.query, this.remoteStore, null, function (data) {
                              return data ? data.asArray() : data;
          Severity: Minor
          Found in src/data/stores/partial/cached_store.js - About 1 hr to fix

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

                        constructor: function (storeInvokee, options) {
                            inherited.constructor.call(this, storeInvokee, Objs.tree_extend({
                                baseURI: "/",
                                methodMap: {
                                    "insert": "POST",
            Severity: Minor
            Found in src/data/stores/invokers/rest_invokers.js - About 1 hr to fix

              Function compileIndexedQuery has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      compileIndexedQuery: function(constrainedQuery, constrainedQueryCapabilities, constrainedQueryFunction, constrainedQueryContext, indices) {
                          constrainedQuery = Constrained.rectify(constrainedQuery);
                          indices = indices || {};
                          if (this.queryPartially(constrainedQuery, constrainedQueryCapabilities) || Types.is_empty(indices))
                              return this.compileQuery(constrainedQuery, constrainedQueryCapabilities, constrainedQueryFunction, constrainedQueryContext);
              Severity: Minor
              Found in src/data/queries/query_engine.js - About 1 hr to fix

                Function _query has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            _query: function (query, options) {
                                return Promise.tryCatch(function () {
                                    var iter = new Iterator();
                                    var store = this;
                                    var fid = this._read_first_id();
                Severity: Minor
                Found in src/data/stores/dumb/dumb_store.js - About 1 hr to fix

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

                          validate_conditions: function(conditions, capabilities) {
                              return Types.is_object(conditions) && Objs.all(conditions, function(value, key) {
                                  return this.validate_condition(value, key, capabilities);
                              }, this);
                          },
                  Severity: Major
                  Found in src/data/queries/queries.js and 1 other location - About 1 hr to fix
                  src/data/queries/queries.js on lines 130..134

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

                  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