Showing 86 of 133 total issues
Function exec
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function exec() {
timeout = 0;
var q = queue, entry, func, out, err, data, resp = [];
queue = null;
Function detect_buffers
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
tests.detect_buffers = function () {
var name = "detect_buffers", detect_client = redis.createClient(null, null, {detect_buffers: true});
detect_client.on("ready", function () {
// single Buffer or String
Function SET
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
, SET: function () {
if (arguments.length < 2) return BAD_ARGS;
var argc = 0;
var key = arguments[argc++];
var value = arguments[argc++];
Function SCAN
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
tests.SCAN = function(){
var name = 'SCAN';
var resultArray = [];
client.flushdb();
Function send_command
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
cl.send_command = function(command, args, callback) {
// Interpret arguments, copy-paste from mranney/redis/index.js for best compat.
if (typeof command !== "string") {
throw new Error("First argument to send_command must be the command name string, not " + typeof command);
Function SINTER
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
tests.SINTER = function () {
var name = "SINTER";
client.del('sa');
client.del('sb');
Function pretty
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.pretty = function(options) {
var pattern, wrap, label;
if (typeof options === 'string')
options = { pattern: options };
Function SUNION
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
, SUNION: function () {
var i, n = arguments.length, out = [];
if (!n) return BAD_ARGS;
for (i = 0; i < n; 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 _scan
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
, _scan: function (allKeys, size, cursor, opt1, opt1val, opt2, opt2val) {
cursor = str2int(cursor);
if (cursor instanceof ERROR)
return cursor;
Function sCombine
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
, sCombine: function (diff, args) {
var i, n = args.length;
if (!n)
return BAD_ARGS;
- 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 structPut
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
, structPut: function (type, validate, revArgs, args) {
var key = args[0], i, n = args.length, x = 0;
if (n < 3 || ((n - 1) % 2)) return BAD_ARGS;
var K = this.getKey(type, key, 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"
Further reading
Function override
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
entry.override = function(queue) {
if (!queue) throw new Error('WOOT! no queue.');
var w = watch, key, entry;
watch = null;
if (w) for (key in w)
Function zOpStore
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
, zOpStore: function (union, key, keys, weights, aggregate) {
var K = this.getSetOrZsetKey(keys[0]);
if (K instanceof ERROR) return K;
var out = {}, member, x = 0, weight = (weights === null ? 1 : weights[0]);
Function HMGET
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
tests.HMGET = function () {
var key1 = "test hash 1", key2 = "test hash 2", key3 = 123456789, name = "HMGET";
// redis-like hmset syntax
client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value", require_string("OK", name));
Consider simplifying this complex logical expression. Open
if ((p && sub.pattern !== null && (channel === null || sub.pattern === channel)) || (!p && sub.pattern === null && (channel === null || sub.channel === channel))) {
x--;
subs.splice(i, 1);
process.nextTick(client.pushMessage.bind(client, p ? 'punsubscribe' : 'unsubscribe', p ? sub.pattern : sub.channel, x));
i--; n--;
Consider simplifying this complex logical expression. Open
else if (func.length && func.length !== entry.args.length) {
err = new Error('Wrong number of arguments for \'' + entry.command.toLowerCase() + '\' command');
data = null;
}
Function getKeyspace
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.getKeyspace = function(options, callback) {
var cb;
if (!callback && typeof options === 'function') {
callback = options;
Function lPopMany
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
, lPopMany: function (left, keys) {
var K = [], value, i, n = keys.length;
if (!n) return BAD_ARGS;
for (i = 0; i < n; i++) {
K[i] = this.getKey(LIST, 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 SUNIONSTORE
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
tests.SUNIONSTORE = function () {
var name = "SUNIONSTORE";
client.del('sa');
client.del('sb');
Function serveKeyspace
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.serveKeyspace = function(port) {
var self = this
, url = require("url");
require("http").createServer(