hdachev/fakeredis

View on GitHub

Showing 86 of 133 total issues

Avoid too many return statements within this function.
Open

    return x;
Severity: Major
Found in lib/backend.js - About 30 mins to fix

    Function SADD has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    , SADD: function () {
        var key = arguments[0]
          , i, n = arguments.length
          , x = 0;
    
    
    Severity: Minor
    Found in lib/backend.js - About 25 mins to fix

    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 HMGET has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    , HMGET: function () {
        var K = this.getKey(HASH, arguments[0]);
        if (K instanceof ERROR) return K;
    
        var i, n = arguments.length, values = [];
    Severity: Minor
    Found in lib/backend.js - About 25 mins to fix

    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 str2float has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    var str2float = function (string) {
      var value = Number(string);
      if (typeof string !== 'string') throw new Error("WOOT! str2float: '" + string + "' not a string.");
      if (string === '+inf') value = Number.POSITIVE_INFINITY;
      else if (string === '-inf') value = Number.NEGATIVE_INFINITY;
    Severity: Minor
    Found in lib/backend.js - About 25 mins to fix

    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 LINSERT has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    , LINSERT: function (key, relpos, pivot, value) {
        var K = this.getKey(LIST, key), x;
        if (K instanceof ERROR) return K;
    
        relpos = relpos.toUpperCase();
    Severity: Minor
    Found in lib/backend.js - About 25 mins to fix

    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 lPush has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    , lPush: function (left, make, args) {
        var i, n = args.length, key = args[0];
        var K = this.getKey(LIST, key, make);
        if (K instanceof ERROR) return K;
        if (n < 2) return BAD_ARGS;
    Severity: Minor
    Found in lib/backend.js - About 25 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language