Showing 10 of 31 total issues
File index.js
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Stream = require('stream');
var Quorum = require('./lib/quorum');
var Connection = require('./lib/connection');
var Pool = require('generic-pool').Pool;
var Balancer = require('./lib/balancer');
Function parse
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
exports.parse = function (response, parse) {
response = Quorum.convert(response);
for (var key in response) {
- 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 _makeRequest
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
RiakPBC.prototype._makeRequest = function (options) {
var self = this;
var stream, callback;
Function _receive
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
ConnectionManager.prototype._receive = function (data) {
var length;
// Make sure we can accomodate the incoming data
Function parse
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.parse = function (response, parse) {
response = Quorum.convert(response);
for (var key in response) {
Avoid deeply nested control flow statements. Open
else if (response.key) {
response[key] = response[key].toString();
}
Function _receive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ConnectionManager.prototype._receive = function (data) {
var length;
// Make sure we can accomodate the incoming data
- 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 (contentType === 'application/json') {
response[key] = JSON.parse(response[key]);
}
else if (textPattern.test(contentType)) {
response[key] = response[key].toString();
Function _makeRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
RiakPBC.prototype._makeRequest = function (options) {
var self = this;
var stream, callback;
- 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 _processMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ConnectionManager.prototype._processMessage = function (data) {
var response, messageCode, err, done;
messageCode = riakproto.codes['' + data[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"