betajs/betajs-data

View on GitHub

Showing 182 of 182 total issues

File queries.js has 546 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Scoped.define("module:Queries", [
    "base:Types",
    "base:Sort",
    "base:Objs",
    "base:Class",
Severity: Major
Found in src/data/queries/queries.js - About 1 day to fix

    File cached_store.js has 510 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Very important to know:
     *  - If both itemCache + remoteStore use the same id_key, the keys actually coincide.
     *  - If they use different keys, the cache stores the remoteStore keys as a foreign key and assigns its own keys to the cached items
     *
    Severity: Major
    Found in src/data/stores/partial/cached_store.js - About 1 day to fix

      File contextualized_store.js has 367 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      Scoped.define("module:Stores.ContextualizedStore", [
          "module:Stores.BaseStore",
          "base:Iterators.MappedIterator"
      ], function (BaseStore, MappedIterator, scoped) {
          return BaseStore.extend({scoped: scoped}, function (inherited) {            
      Severity: Minor
      Found in src/data/stores/delegators/contextualized_store.js - About 4 hrs to fix

        File abstract_query_collection.js has 367 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @class AbstractQueryCollection
         *
         * A base class for querying collections. Subclasses specify the expected type
         * of data store and specify whether the query collection is active.
        Severity: Minor
        Found in src/collections/abstract_query_collection.js - About 4 hrs to fix

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

                       _toContext: function (member, uriData, post, get, ctx) {
                          var data = null;
                          if (this.__options.toContext)
                              data = this.__options.toContext.call(this.__options.context, member, uriData, post, get, ctx);
                          return data || (member in this.__options.contextMap ? this.__options.contextMap[member].call(this.__options.context, member, uriData, post, get, ctx) : null);
          Severity: Major
          Found in src/data/stores/invokers/rest_invokers.js and 1 other location - About 4 hrs to fix
          src/data/stores/invokers/rest_invokers.js on lines 166..171

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

          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

                       _toData: function (member, uriData, post, get, ctx) {
                          var data = null;
                          if (this.__options.toData)
                              data = this.__options.toData.call(this.__options.context, member, uriData, post, get, ctx);
                          return data || (member in this.__options.dataMap ? this.__options.dataMap[member].call(this.__options.context, member, uriData, post, get, ctx) : null);
          Severity: Major
          Found in src/data/stores/invokers/rest_invokers.js and 1 other location - About 4 hrs to fix
          src/data/stores/invokers/rest_invokers.js on lines 173..178

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

          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

                      bounds_backwards: function(newLowerBound) {
                          var oldLowerBound = this._query.query[this._bounds_attribute].$gte;
                          this._query.query[this._bounds_attribute].$gte = newLowerBound;
                          var queryCopy = Objs.clone(this._query.query, 2);
                          queryCopy[this._bounds_attribute].$lt = oldLowerBound;
          Severity: Major
          Found in src/collections/abstract_query_collection.js and 1 other location - About 4 hrs to fix
          src/collections/abstract_query_collection.js on lines 206..214

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

          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

                      bounds_forwards: function(newUpperBound) {
                          var oldUpperBound = this._query.query[this._bounds_attribute].$lt;
                          this._query.query[this._bounds_attribute].$lt = newUpperBound;
                          var queryCopy = Objs.clone(this._query.query, 2);
                          queryCopy[this._bounds_attribute].$gte = oldUpperBound;
          Severity: Major
          Found in src/collections/abstract_query_collection.js and 1 other location - About 4 hrs to fix
          src/collections/abstract_query_collection.js on lines 216..224

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

          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

          var s = function (Data) {
              var store = new Data.Stores.MemoryStore();
              store.indices.j = new Data.Stores.MemoryIndex(store, "j");
              for (var i = 0; i < 100; ++i)
                  for (var j = 0; j < 100; ++j)
          Severity: Major
          Found in benchmarks/compare/memory_store_query_with_index.js and 1 other location - About 4 hrs to fix
          benchmarks/compare/memory_map_store_query_with_index.js on lines 1..8

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

          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

          var s = function (Data) {
              var store = new Data.Stores.MemoryMapStore();
              store.indices.j = new Data.Stores.MemoryIndex(store, "j");
              for (var i = 0; i < 100; ++i)
                  for (var j = 0; j < 100; ++j)
          Severity: Major
          Found in benchmarks/compare/memory_map_store_query_with_index.js and 1 other location - About 4 hrs to fix
          benchmarks/compare/memory_store_query_with_index.js on lines 1..8

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

          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

                      _toGet: function (member, data, context) {
                          var result = null;
                          if (this.__options.toGet)
                              result = this.__options.toGet.call(this.__options.context, member, data, context);
                          return result || (member in this.__options.getMap ? this.__options.getMap[member].call(this.__options.context, data, context) : null);
          Severity: Major
          Found in src/data/stores/invokers/rest_invokers.js and 1 other location - About 4 hrs to fix
          src/data/stores/invokers/rest_invokers.js on lines 82..87

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

          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

                      _toData: function (member, data, context) {
                          var result = null;
                          if (this.__options.toData)
                              result = this.__options.toData.call(this.__options.context, member, data, context);
                          return result || (member in this.__options.dataMap ? this.__options.dataMap[member].call(this.__options.context, data, context) : null);
          Severity: Major
          Found in src/data/stores/invokers/rest_invokers.js and 1 other location - About 4 hrs to fix
          src/data/stores/invokers/rest_invokers.js on lines 89..94

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

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

                  compileIndexQuery: function(constrainedDNFQuery, key, index) {
                      var fullQuery = Objs.exists(constrainedDNFQuery.query.$or, function(query) {
                          return !(key in query);
                      });
                      var primaryKeySort = constrainedDNFQuery.options.sort && Objs.ithKey(constrainedDNFQuery.options.sort, 0) === key;
          Severity: Major
          Found in src/data/queries/query_engine.js - About 3 hrs to fix

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

                            } else if (subValue.$lt || subValue.$lte) {
                                if (superValue.$gt || superValue.$gte)
                                    return false;
                                if (superValue.$lt || superValue.$lte) {
                                    if ((superValue.$lt || superValue.$lte) < (subValue.$lt || subValue.$lte))
            Severity: Major
            Found in src/data/queries/queries.js and 1 other location - About 3 hrs to fix
            src/data/queries/queries.js on lines 335..343

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

            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

                                } else {
                                    if (superValue.$lt || superValue.$lte)
                                        return false;
                                    if (superValue.$gt || superValue.$gte) {
                                        if ((superValue.$gt || superValue.$gte) > (subValue.$gt || subValue.$gte))
            Severity: Major
            Found in src/data/queries/queries.js and 1 other location - About 3 hrs to fix
            src/data/queries/queries.js on lines 344..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 109.

            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

            File partial_store_write_strategies.js has 320 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            Scoped.define("module:Stores.PartialStoreWriteStrategies.WriteStrategy", [
                                                                                      "base:Class"
                                                                                      ], function (Class, scoped) {
                return Class.extend({scoped: scoped}, function (inherited) {
                    return {
            Severity: Minor
            Found in src/data/stores/partial/partial_store_write_strategies.js - About 3 hrs to fix

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

                          constructor: function (store, options) {
                              this.__store = store;
                              options = options || {};
                              options.id_key = store.id_key();
                              inherited.constructor.call(this, options);
              Severity: Major
              Found in src/data/stores/delegators/resilient_store.js and 1 other location - About 3 hrs to fix
              src/data/stores/delegators/async_store.js on lines 10..18

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

              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

                          constructor: function (store, options) {
                              this.__store = store;
                              options = options || {};
                              options.id_key = store.id_key();
                              inherited.constructor.call(this, options);
              Severity: Major
              Found in src/data/stores/delegators/async_store.js and 1 other location - About 3 hrs to fix
              src/data/stores/delegators/resilient_store.js on lines 9..17

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

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

                          constructor: function(attributes, collection) {
                              inherited.constructor.call(this, attributes);
              
                              var silent = false;
                              var items = collection || this.auto_destroy(new Collection());
              Severity: Major
              Found in src/modelling/grouped.js - About 3 hrs to fix

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

                                    if (metaAttr.add) {
                                        this.on("items:add", function(item) {
                                            groupValue = metaAttr.add(groupValue, item.get(attrKey), item);
                                            silent = true;
                                            this.set(attrKey, metaAttr.map ? metaAttr.map(groupValue) : groupValue);
                Severity: Major
                Found in src/modelling/grouped.js and 1 other location - About 3 hrs to fix
                src/modelling/grouped.js on lines 61..68

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

                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