Showing 17 of 25 total issues
File adapter.js
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var _ = require('underscore'),
async = require('async'),
Connection = require('./connection'),
Function define
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.define = function define(collectionName, definition, cb) {
var collection = this.getDef(collectionName),
_this = this,
tableCreateOptions = {},
- 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 Connection
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Connection(options) {
///////////////////////
// Private variables //
///////////////////////
Function update
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.update = function update(collectionName, options, values, cb) {
var collection = this.getDef(collectionName),
_this = this;
Function define
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.define = function define(collectionName, definition, cb) {
var collection = this.getDef(collectionName),
_this = this,
tableCreateOptions = {},
Function Connection
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function Connection(options) {
///////////////////////
// Private variables //
///////////////////////
- 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 find
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.find = function find(collectionName, options, cb) {
var collection = this.getDef(collectionName),
_this = this;
Function exports
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
Function create
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.create = function create(collectionName, values, cb) {
var queries = [],
collection = this.getDef(collectionName),
_this = this;
Function RethinkDBAdapter
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function RethinkDBAdapter(options) {
///////////////////////
// Private variables //
///////////////////////
Function update
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.update = function update(collectionName, options, values, cb) {
var collection = this.getDef(collectionName),
_this = this;
- 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 create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.create = function create(collectionName, values, cb) {
var queries = [],
collection = this.getDef(collectionName),
_this = this;
- 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 _configure
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _configure(options, strict) {
var errorPrefix = 'Connection.configure(options, strict): options';
if (!_.isObject(options)) {
throw new Error(errorPrefix + ': must be an object!');
Avoid deeply nested control flow statements. Open
if (result > 0) {
cb('Unique constraint failure!');
} else {
cb();
}
Function find
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.find = function find(collectionName, options, cb) {
var collection = this.getDef(collectionName),
_this = this;
- 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
Avoid deeply nested control flow statements. Open
if (definition[key][k].autoIncrement) {
delete definition[key][k].autoIncrement;
}
Function count
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
RethinkDBAdapter.prototype.count = function count(collectionName, options, cb) {
var collection = this.getDef(collectionName);
options = options || {};
- 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"