Showing 13 of 27 total issues
File client.js
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var Promise = require('bluebird');
var Pool = require('./pool');
var _ = require('lodash');
Function connect
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Connection.prototype.connect = function () {
var self = this;
if (self.connected) {
return Promise.resolve();
Function Client
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Client(options) {
var self = this;
self.options = _.defaultsDeep(options || {}, {
clientId: 'no-riak-client',
Function _next
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Pool.prototype._next = function () {
var self = this;
return Promise.try(function () {
var connection = self.connections.free.shift();
Function _receive
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Connection.prototype._receive = function (data) {
var length;
if (!this.connected) {
return;
- 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 _ping
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Client.prototype._ping = function (host, port, isFailover) {
var self = this, connection;
if (self._pinging[host + ':' + port]) {
return undefined;
Function _setValue
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
RMap.prototype._setValue = function (v) {
var self = this;
if (v && v.map_value) {
self._fields = v.map_value.map(function (entry) {
Function _fields
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
self._fields = v.map_value.map(function (entry) {
var value;
switch (mapFieldTypes[entry.field.type]) {
case 'COUNTER':
value = new Counter();
Function _receive
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Connection.prototype._receive = function (data) {
var length;
if (!this.connected) {
return;
Function _checkConnection
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Client.prototype._checkConnection = function (err, c) {
var self = this, s, now = Date.now(), servers = c.isFailover() ? self.failoverServers : self.servers;
if (err instanceof errors.RiakConnectionError) {
s = servers.get({ host: c.host(), port: c.port() });
Function _convertRpbGetResponse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Client.prototype._convertRpbGetResponse = function (result) {
var self = this;
if (result) {
if (result.vclock) {
- 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 _checkConnection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Client.prototype._checkConnection = function (err, c) {
var self = this, s, now = Date.now(), servers = c.isFailover() ? self.failoverServers : self.servers;
if (err instanceof errors.RiakConnectionError) {
s = servers.get({ host: c.host(), port: c.port() });
- 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 _process
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Connection.prototype._process = function (data) {
var self = this, result, done;
try {
result = self.protocol.read(data).Response().result;
- 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"