noppoMan/npdynamodb

View on GitHub

Showing 15 of 74 total issues

File query_builder_read_spec.js has 593 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

var Promise = require('bluebird')
var chai = require('chai');
var expect = chai.expect;
Severity: Major
Found in test/query_builder_read_spec.js - About 1 day to fix

    File orm_spec.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var npdynamodb = require('../index');
    var chai = require('chai');
    var expect = chai.expect;
    Severity: Minor
    Found in test/orm_spec.js - About 2 hrs to fix

      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

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

                          Avoid too many return statements within this function.
                          Open

                            return false;
                          Severity: Major
                          Found in lib/utils.js - About 30 mins to fix

                            Function buildQuery has a Cognitive Complexity of 6 (exceeds 5 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 25 mins to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Function isEmpty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            exports.isEmpty = function(val){
                              if(val === null) return true;
                              if(val === '') return true;
                              if(_.isArray(val) && val.length === 0) return true;
                              if(_.isObject(val) && _.keys(val).length === 0) return true;
                            Severity: Minor
                            Found in lib/utils.js - About 25 mins to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Severity
                            Category
                            Status
                            Source
                            Language