Showing 86 of 133 total issues
Function slice
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var slice = function (arr, start, stop, asCount) {
start = str2int(start);
stop = str2int(stop);
if (start instanceof ERROR) return start;
if (stop instanceof ERROR) return stop;
Function getKeyspace
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.getKeyspace = function(options, callback) {
var cb;
if (!callback && typeof options === 'function') {
callback = 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"
Further reading
Function structDel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
, structDel: function (type, args) {
var key = args[0]
, i, n = args.length
, x;
- 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 zGetRangeByScore
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
, zGetRangeByScore: function (rev, args) {
var key = args[0], min = args[rev ? 2 : 1], max = args[rev ? 1 : 2]
, scores, limit, offset, count;
if (args.length < 3)
- 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 _scan
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
, _scan: function (allKeys, size, cursor, opt1, opt1val, opt2, opt2val) {
Avoid deeply nested control flow statements. Open
if (!(member in out)) {
x++;
out[member] = K.value[member]* weight;
}
Avoid deeply nested control flow statements. Open
if (queue && !timeout)
timeout = setTimeout(exec, randLat());
Avoid deeply nested control flow statements. Open
else for (member in out) if (!(member in K.value)) {
delete out[member];
x--;
}
Function packageBuffer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function packageBuffer(buf) {
// If possible, try storing the buffer as a utf8 string.
// For this to work baking the string back to a buffer must yield the exact same bytes.
var asString = buf.toString('utf8');
- 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 (entry.command !== "EXEC") {
// Collect replies for the EXEC output.
entry.callback = cb;
Avoid deeply nested control flow statements. Open
if (resp.length)
flush(resp);
Avoid deeply nested control flow statements. Open
if (entry.block && typeof entry.block === 'number')
setTimeout(unblock.bind(null, entry), entry.block * 1000);
Avoid deeply nested control flow statements. Open
if (w) for (key in w)
if (backend.getRevision(key) !== w[key]) {
// Abort because of a change in the watched keyspace.
n = 0;
Avoid deeply nested control flow statements. Open
if (queue[i].command === "MULTI") {
queue.splice(i, queue.length);
// This will substitute the DISCARD command with an UNWATCH,
// hence the recursive call to this.push.
Consider simplifying this complex logical expression. Open
if ((diff && (K && K.value[out[j]])) || (!diff && !(K && K.value[out[j]]))) {
out.splice(j, 1);
j--;
m--;
}
Function zOpStore
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
, zOpStore: function (union, key, keys, weights, aggregate) {
Function zSort
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
, zSort: function (rev, key, min, max) {
var K = this.getKey(ZSET, key);
if (K instanceof ERROR) return K;
if (!K) 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 pretty
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.pretty = function(options) {
var pattern, wrap, label;
if (typeof options === 'string')
options = { pattern: 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"
Further reading
Function FAKE_DUMP
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
, FAKE_DUMP: function (pattern) {
var keys = this.KEYS(pattern), i, n = keys.length, out = [], key, type;
for (i = 0; i < n; i++) {
key = keys[i];
- 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 zUnwrap
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
, zUnwrap: function (range, scores) {
var i, n = range.length, out = n ?[] : range;
if (n)
for (i = 0; i < n; i++) {
out.push(range[i].member);
- 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"