main.js
Function createClient
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
Open
exports.createClient = function(port, host, options) {
if (arguments.length == 1 && typeof port == "object") {
options = port;
if (options.port || options.host) {
port = options.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 createClient
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.createClient = function(port, host, options) {
if (arguments.length == 1 && typeof port == "object") {
options = port;
if (options.port || options.host) {
port = options.port;
Function send_command
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 packageBuffer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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"