noppoMan/npdynamodb

View on GitHub

Showing 74 of 74 total issues

Function exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(tableName, prototypeProps, staticProps){

  var reservedProps = ['hashKey', 'rangeKey', 'npdynamodb'];

  function Model(attributes){
Severity: Minor
Found in lib/orm/index.js - About 1 hr to fix

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

        t.localSecondaryIndex('indexName2', function(t){
          t.string('hash_key').hashKey();
          t.number('lsi_range_key').rangeKey();
          t.projectionTypeAll();
        });
    Severity: Major
    Found in test/migrations/20150404071625_create_test_table1.js and 6 other locations - About 1 hr to fix
    test/migrations/20150404071722_create_test_table2.js on lines 27..31
    test/migrations/20150404071722_create_test_table2.js on lines 33..37
    test/migrations/20150404071722_create_test_table2.js on lines 39..43
    test/schema_spec.js on lines 38..42
    test/schema_spec.js on lines 44..48
    test/schema_spec.js on lines 50..54

    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 7 locations. Consider refactoring.
    Open

        t.localSecondaryIndex('indexName5', function(t){
          t.string('hash_key').hashKey();
          t.string('lsi_range_key2').rangeKey();
          t.projectionTypeAll();
        });
    Severity: Major
    Found in test/schema_spec.js and 6 other locations - About 1 hr to fix
    test/migrations/20150404071625_create_test_table1.js on lines 15..19
    test/migrations/20150404071722_create_test_table2.js on lines 27..31
    test/migrations/20150404071722_create_test_table2.js on lines 33..37
    test/migrations/20150404071722_create_test_table2.js on lines 39..43
    test/schema_spec.js on lines 38..42
    test/schema_spec.js on lines 50..54

    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 7 locations. Consider refactoring.
    Open

        t.localSecondaryIndex('indexName6', function(t){
          t.string('hash_key').hashKey();
          t.binary('lsi_range_key3').rangeKey();
          t.projectionTypeAll();
        });
    Severity: Major
    Found in test/schema_spec.js and 6 other locations - About 1 hr to fix
    test/migrations/20150404071625_create_test_table1.js on lines 15..19
    test/migrations/20150404071722_create_test_table2.js on lines 27..31
    test/migrations/20150404071722_create_test_table2.js on lines 33..37
    test/migrations/20150404071722_create_test_table2.js on lines 39..43
    test/schema_spec.js on lines 38..42
    test/schema_spec.js on lines 44..48

    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 7 locations. Consider refactoring.
    Open

        t.localSecondaryIndex('indexName5', function(t){
          t.string('hash_key').hashKey();
          t.string('lsi_range_key2').rangeKey();
          t.projectionTypeAll();
        });
    Severity: Major
    Found in test/migrations/20150404071722_create_test_table2.js and 6 other locations - About 1 hr to fix
    test/migrations/20150404071625_create_test_table1.js on lines 15..19
    test/migrations/20150404071722_create_test_table2.js on lines 27..31
    test/migrations/20150404071722_create_test_table2.js on lines 39..43
    test/schema_spec.js on lines 38..42
    test/schema_spec.js on lines 44..48
    test/schema_spec.js on lines 50..54

    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 7 locations. Consider refactoring.
    Open

        t.localSecondaryIndex('indexName4', function(t){
          t.string('hash_key').hashKey();
          t.number('lsi_range_key').rangeKey();
          t.projectionTypeAll();
        });
    Severity: Major
    Found in test/migrations/20150404071722_create_test_table2.js and 6 other locations - About 1 hr to fix
    test/migrations/20150404071625_create_test_table1.js on lines 15..19
    test/migrations/20150404071722_create_test_table2.js on lines 33..37
    test/migrations/20150404071722_create_test_table2.js on lines 39..43
    test/schema_spec.js on lines 38..42
    test/schema_spec.js on lines 44..48
    test/schema_spec.js on lines 50..54

    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 7 locations. Consider refactoring.
    Open

        t.localSecondaryIndex('indexName6', function(t){
          t.string('hash_key').hashKey();
          t.binary('lsi_range_key3').rangeKey();
          t.projectionTypeAll();
        });
    Severity: Major
    Found in test/migrations/20150404071722_create_test_table2.js and 6 other locations - About 1 hr to fix
    test/migrations/20150404071625_create_test_table1.js on lines 15..19
    test/migrations/20150404071722_create_test_table2.js on lines 27..31
    test/migrations/20150404071722_create_test_table2.js on lines 33..37
    test/schema_spec.js on lines 38..42
    test/schema_spec.js on lines 44..48
    test/schema_spec.js on lines 50..54

    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 7 locations. Consider refactoring.
    Open

        t.localSecondaryIndex('indexName4', function(t){
          t.string('hash_key').hashKey();
          t.number('lsi_range_key').rangeKey();
          t.projectionTypeAll();
        });
    Severity: Major
    Found in test/schema_spec.js and 6 other locations - About 1 hr to fix
    test/migrations/20150404071625_create_test_table1.js on lines 15..19
    test/migrations/20150404071722_create_test_table2.js on lines 27..31
    test/migrations/20150404071722_create_test_table2.js on lines 33..37
    test/migrations/20150404071722_create_test_table2.js on lines 39..43
    test/schema_spec.js on lines 44..48
    test/schema_spec.js on lines 50..54

    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

    Function up has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.up = function(migrator){
      return migrator().createTable('test_table2', function(t){
        t.string('hash_key').hashKey();
        t.binary('range_key').rangeKey();
        t.provisionedThroughput(100, 100);
    Severity: Minor
    Found in test/migrations/20150404071722_create_test_table2.js - About 1 hr to fix

      Function promiseInterface has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        QueryBuilder.prototype[promiseInterface] = function(cb){
          var self = this;
          var feature = self._feature;
          var callbacks = this._callbacks;
          var timer;
      Severity: Minor
      Found in lib/query_builder.js - About 1 hr to fix

        Function run has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        MigrateRunner.prototype.run = function(){
          var self = this;
          var tableName = this.config.migrations.tableName;
        
          return this._createMigrateTableIfNotExits().then(function(){
        Severity: Minor
        Found in lib/migrate/migrator.js - About 1 hr to fix

          Function stabData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var stabData = _.range(1, 11).map(function(i){
            return {
              hash_key: "key1",
              range_key: i,
              gsi_hash_key: "gkey1", //gsi
          Severity: Minor
          Found in test/data/complex_table_seed.js - About 1 hr to fix

            Function rollback has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            MigrateRunner.prototype.rollback = function(){
              var self = this;
              var tableName = this.config.migrations.tableName;
            
              var pglob = Promise.promisify(glob);
            Severity: Minor
            Found in lib/migrate/migrator.js - About 1 hr to fix

              Function buildUpdateTable has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.buildUpdateTable = function(){
              
                var items = makeBaseItems.call(this);
                var indexType = this._schema.IndexType;
              
              
              Severity: Minor
              Found in lib/dialects/2012-08-10/schema.js - About 1 hr to fix

                Function buildQuery has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Feature.prototype.buildQuery = function(){
                  var nextThen = this.nextThen || 'query';
                  var self = this;
                
                  if(this.whereInConditions.length > 0 && this.whereConditions.length > 0) {
                Severity: Minor
                Found in lib/dialects/2012-08-10/feature.js - About 1 hr to fix

                  Function buildCreateTable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.buildCreateTable = function(){
                  
                    var items = makeBaseItems.call(this);
                  
                    _.each(this.childBuilders, function(def){
                  Severity: Minor
                  Found in lib/dialects/2012-08-10/schema.js - About 1 hr to fix

                    Function makeBaseItems has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function makeBaseItems(){
                      var items = {
                        TableName: this._schema.tableName
                      };
                    
                    
                    Severity: Minor
                    Found in lib/dialects/2012-08-10/schema.js - About 1 hr to fix

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

                      SchemaBuilder.prototype.streamSpecificationEnabled = function(bool){
                        this._definePropsIfNotExists('StreamSpecification');
                        this._schema.tableInfo.StreamSpecification.StreamEnabled = bool;
                      };
                      Severity: Minor
                      Found in lib/schema/builder.js and 1 other location - About 55 mins to fix
                      lib/schema/builder.js on lines 90..93

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

                      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

                      SchemaBuilder.prototype.streamSpecificationViewType = function(type){
                        this._definePropsIfNotExists('StreamSpecification');
                        this._schema.tableInfo.StreamSpecification.StreamViewType = type;
                      };
                      Severity: Minor
                      Found in lib/schema/builder.js and 1 other location - About 55 mins to fix
                      lib/schema/builder.js on lines 85..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 54.

                      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

                      Migrator.prototype.waitForTableExists = function(tableName) {
                        return this.npd().rawClient().waitFor('tableExists', {
                          TableName: tableName
                        });
                      };
                      Severity: Minor
                      Found in lib/migrate/migrator.js and 1 other location - About 55 mins to fix
                      lib/migrate/migrator.js on lines 97..101

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

                      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