hdachev/fakeredis

View on GitHub

Showing 133 of 133 total issues

Function SORT has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

tests.SORT = function () {
    var name = "SORT";

    client.del('y');
    client.del('x');
Severity: Major
Found in redis.test.js - About 3 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    , ZREMRANGEBYRANK: function (key, start, stop) {
        var members = this.ZRANGE(key, start, stop), n = members.length;
        if (n)
          n = this.ZREM.apply(this, [key].concat(members));
    
    
    Severity: Major
    Found in lib/backend.js and 1 other location - About 2 hrs to fix
    lib/backend.js on lines 1594..1600

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 87.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    , ZREMRANGEBYSCORE: function (key, min, max) {
        var members = this.ZRANGEBYSCORE(key, min, max), n = members.length;
        if (n)
          n = this.ZREM.apply(this, [key].concat(members));
    
    
    Severity: Major
    Found in lib/backend.js and 1 other location - About 2 hrs to fix
    lib/backend.js on lines 1586..1592

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 87.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function LREM has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    , LREM: function (key, count, value) {
        var K = this.getKey(LIST, key);
        if (K instanceof ERROR) return K;
        count = str2int(count);
        if (count instanceof ERROR) return count;
    Severity: Minor
    Found in lib/backend.js - About 2 hrs 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 _scan has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    , _scan: function (allKeys, size, cursor, opt1, opt1val, opt2, opt2val) {
        cursor = str2int(cursor);
        if (cursor instanceof ERROR)
          return cursor;
    
    
    Severity: Minor
    Found in lib/backend.js - About 2 hrs 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        client.sinter('sa', 'sb', function (err, intersection) {
            if (err) {
                assert.fail(err, name);
            }
            assert.equal(intersection.length, 2, name);
    Severity: Major
    Found in redis.test.js and 1 other location - About 2 hrs to fix
    redis.test.js on lines 1747..1753

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        client.sinter('sb', 'sc', function (err, intersection) {
            if (err) {
                assert.fail(err, name);
            }
            assert.equal(intersection.length, 2, name);
    Severity: Major
    Found in redis.test.js and 1 other location - About 2 hrs to fix
    redis.test.js on lines 1739..1745

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function zParseOpStore has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    , zParseOpStore: function (union, args) {
        var key = args[0], N = str2int(args[1]);
        if (N instanceof ERROR) return N;
        if (N < 1) return BAD_ZUIS;
        if (args.length < N + 2) return BAD_ARGS;
    Severity: Minor
    Found in lib/backend.js - About 2 hrs 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 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;
    
    
    Severity: Major
    Found in lib/connection.js - About 2 hrs to fix

      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
      Severity: Major
      Found in redis.test.js - About 2 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                detect_client.get(new Buffer("string key 1"), function (err, reply) {
                    assert.strictEqual(null, err, name);
                    assert.strictEqual(true, Buffer.isBuffer(reply), name);
                    assert.strictEqual("<Buffer 73 74 72 69 6e 67 20 76 61 6c 75 65>", reply.inspect(), name);
                });
        Severity: Major
        Found in redis.test.js and 1 other location - About 2 hrs to fix
        redis.test.js on lines 2275..2279

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 77.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            client4.get(new Buffer("string key 1"), function (err, reply) {
                assert.strictEqual(null, err, name);
                assert.strictEqual(true, Buffer.isBuffer(reply), name);
                assert.strictEqual("<Buffer 73 74 72 69 6e 67 20 76 61 6c 75 65>", reply.inspect(), name);
            });
        Severity: Major
        Found in redis.test.js and 1 other location - About 2 hrs to fix
        redis.test.js on lines 726..730

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 77.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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++];
        Severity: Major
        Found in lib/backend.js - About 2 hrs to fix

          Function SCAN has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          tests.SCAN = function(){
              var name = 'SCAN';
              var resultArray = [];
          
              client.flushdb();
          Severity: Major
          Found in redis.test.js - About 2 hrs to fix

            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);
            Severity: Minor
            Found in main.js - About 1 hr to fix

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  client.HMGET(key1, "0123456789", "some manner of key", function (err, reply) {
                      assert.strictEqual("abcdefghij", reply[0].toString(), name);
                      assert.strictEqual("a type of value", reply[1].toString(), name);
                  });
              Severity: Major
              Found in redis.test.js and 2 other locations - About 1 hr to fix
              redis.test.js on lines 977..980
              redis.test.js on lines 982..985

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 69.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  client.HMGET(key3, "0123456789", "some manner of key", function (err, reply) {
                      assert.strictEqual("abcdefghij", reply[0].toString(), name);
                      assert.strictEqual("a type of value", reply[1].toString(), name);
                  });
              Severity: Major
              Found in redis.test.js and 2 other locations - About 1 hr to fix
              redis.test.js on lines 972..975
              redis.test.js on lines 977..980

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 69.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  client.HMGET(key2, "0123456789", "some manner of key", function (err, reply) {
                      assert.strictEqual("abcdefghij", reply[0].toString(), name);
                      assert.strictEqual("a type of value", reply[1].toString(), name);
                  });
              Severity: Major
              Found in redis.test.js and 2 other locations - About 1 hr to fix
              redis.test.js on lines 972..975
              redis.test.js on lines 982..985

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 69.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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');
              Severity: Minor
              Found in redis.test.js - About 1 hr to fix

                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 };
                Severity: Minor
                Found in lib/helpers.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language