Showing 15 of 74 total issues
File query_builder_read_spec.js
has 593 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
var Promise = require('bluebird')
var chai = require('chai');
var expect = chai.expect;
File orm_spec.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
var npdynamodb = require('../index');
var chai = require('chai');
var expect = chai.expect;
Function exports
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(tableName, prototypeProps, staticProps){
var reservedProps = ['hashKey', 'rangeKey', 'npdynamodb'];
function Model(attributes){
Function up
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function run
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
MigrateRunner.prototype.run = function(){
var self = this;
var tableName = this.config.migrations.tableName;
return this._createMigrateTableIfNotExits().then(function(){
Function promiseInterface
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
QueryBuilder.prototype[promiseInterface] = function(cb){
var self = this;
var feature = self._feature;
var callbacks = this._callbacks;
var timer;
Function stabData
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var stabData = _.range(1, 11).map(function(i){
return {
hash_key: "key1",
range_key: i,
gsi_hash_key: "gkey1", //gsi
Function rollback
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
MigrateRunner.prototype.rollback = function(){
var self = this;
var tableName = this.config.migrations.tableName;
var pglob = Promise.promisify(glob);
Function buildUpdateTable
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.buildUpdateTable = function(){
var items = makeBaseItems.call(this);
var indexType = this._schema.IndexType;
Function buildQuery
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Feature.prototype.buildQuery = function(){
var nextThen = this.nextThen || 'query';
var self = this;
if(this.whereInConditions.length > 0 && this.whereConditions.length > 0) {
Function buildCreateTable
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.buildCreateTable = function(){
var items = makeBaseItems.call(this);
_.each(this.childBuilders, function(def){
Function makeBaseItems
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function makeBaseItems(){
var items = {
TableName: this._schema.tableName
};
Avoid too many return
statements within this function. Open
Open
return false;
Function buildQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
Feature.prototype.buildQuery = function(){
var nextThen = this.nextThen || 'query';
var self = this;
if(this.whereInConditions.length > 0 && this.whereConditions.length > 0) {
- Read upRead up
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
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;
- Read upRead up
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"