Showing 96 of 96 total issues

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

    def pexpireat(self, key, timestamp):
        """:meth:`~tredis.RedisClient.pexpireat` has the same effect and
        semantic as :meth:`~tredis.RedisClient.expireat`, but the Unix time
        at which the key will expire is specified in milliseconds instead of
        seconds.
Severity: Major
Found in tredis/keys.py and 4 other locations - About 45 mins to fix
tredis/keys.py on lines 86..126
tredis/keys.py on lines 128..150
tredis/keys.py on lines 240..259
tredis/keys.py on lines 328..345

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 35.

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 expiring_set has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def expiring_set(self, key, value, expiration=None, nx=None, xx=None):
Severity: Minor
Found in tests/base.py - About 35 mins to fix

    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self,
    Severity: Minor
    Found in tredis/client.py - About 35 mins to fix

      Function auth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def auth(self, password):
              """Request for authentication in a password-protected Redis server.
              Redis can be instructed to require a password before allowing clients
              to execute commands. This is done using the ``requirepass`` directive
              in the configuration file.
      Severity: Minor
      Found in tredis/server.py - About 35 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

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

          @testing.gen_test
          def test_bad_connect_raises_exception(self):
              with self.assertRaises(exceptions.ConnectError):
                  yield self.client.connect()
      Severity: Minor
      Found in tests/connect_tests.py and 1 other location - About 35 mins to fix
      tests/connect_tests.py on lines 39..42

      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 33.

      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

          @testing.gen_test
          def test_bad_connect_db_raises_exception(self):
              with self.assertRaises(exceptions.RedisError):
                  yield self.client.connect()
      Severity: Minor
      Found in tests/connect_tests.py and 1 other location - About 35 mins to fix
      tests/connect_tests.py on lines 25..28

      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 33.

      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

      Avoid too many return statements within this function.
      Open

                  return b''.join(output)
      Severity: Major
      Found in tredis/client.py - About 30 mins to fix

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

            def sunionstore(self, destination, *keys):
                """This command is equal to :meth:`~tredis.RedisClient.sunion`, but
                instead of returning the resulting set, it is stored in destination.
        
                If destination already exists, it is overwritten.
        Severity: Major
        Found in tredis/sets.py and 7 other locations - About 30 mins to fix
        tredis/lists.py on lines 120..150
        tredis/lists.py on lines 152..176
        tredis/lists.py on lines 195..224
        tredis/lists.py on lines 226..249
        tredis/sets.py on lines 82..101
        tredis/sets.py on lines 133..152
        tredis/sortedsets.py on lines 236..255

        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 32.

        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 8 locations. Consider refactoring.
        Open

            def lpushx(self, key, *values):
                """
                Insert values at the head of an existing list.
        
                :param key: The list's key
        Severity: Major
        Found in tredis/lists.py and 7 other locations - About 30 mins to fix
        tredis/lists.py on lines 120..150
        tredis/lists.py on lines 195..224
        tredis/lists.py on lines 226..249
        tredis/sets.py on lines 82..101
        tredis/sets.py on lines 133..152
        tredis/sets.py on lines 403..422
        tredis/sortedsets.py on lines 236..255

        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 32.

        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 8 locations. Consider refactoring.
        Open

            def rpushx(self, key, *values):
                """
                Insert values at the tail of an existing list.
        
                :param key: The list's key
        Severity: Major
        Found in tredis/lists.py and 7 other locations - About 30 mins to fix
        tredis/lists.py on lines 120..150
        tredis/lists.py on lines 152..176
        tredis/lists.py on lines 195..224
        tredis/sets.py on lines 82..101
        tredis/sets.py on lines 133..152
        tredis/sets.py on lines 403..422
        tredis/sortedsets.py on lines 236..255

        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 32.

        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 8 locations. Consider refactoring.
        Open

            def lpush(self, key, *values):
                """
                Insert all the specified values at the head of the list stored at key.
        
                :param key: The list's key
        Severity: Major
        Found in tredis/lists.py and 7 other locations - About 30 mins to fix
        tredis/lists.py on lines 152..176
        tredis/lists.py on lines 195..224
        tredis/lists.py on lines 226..249
        tredis/sets.py on lines 82..101
        tredis/sets.py on lines 133..152
        tredis/sets.py on lines 403..422
        tredis/sortedsets.py on lines 236..255

        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 32.

        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 8 locations. Consider refactoring.
        Open

            def sinterstore(self, destination, *keys):
                """This command is equal to :meth:`~tredis.RedisClient.sinter`, but
                instead of returning the resulting set, it is stored in destination.
        
                If destination already exists, it is overwritten.
        Severity: Major
        Found in tredis/sets.py and 7 other locations - About 30 mins to fix
        tredis/lists.py on lines 120..150
        tredis/lists.py on lines 152..176
        tredis/lists.py on lines 195..224
        tredis/lists.py on lines 226..249
        tredis/sets.py on lines 82..101
        tredis/sets.py on lines 403..422
        tredis/sortedsets.py on lines 236..255

        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 32.

        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 8 locations. Consider refactoring.
        Open

            def zrem(self, key, *members):
                """Removes the specified members from the sorted set stored at key.
                 Non existing members are ignored.
        
                An error is returned when key exists and does not hold a sorted set.
        Severity: Major
        Found in tredis/sortedsets.py and 7 other locations - About 30 mins to fix
        tredis/lists.py on lines 120..150
        tredis/lists.py on lines 152..176
        tredis/lists.py on lines 195..224
        tredis/lists.py on lines 226..249
        tredis/sets.py on lines 82..101
        tredis/sets.py on lines 133..152
        tredis/sets.py on lines 403..422

        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 32.

        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 8 locations. Consider refactoring.
        Open

            def rpush(self, key, *values):
                """
                Insert all the specified values at the tail of the list stored at key.
        
                :param key: The list's key
        Severity: Major
        Found in tredis/lists.py and 7 other locations - About 30 mins to fix
        tredis/lists.py on lines 120..150
        tredis/lists.py on lines 152..176
        tredis/lists.py on lines 226..249
        tredis/sets.py on lines 82..101
        tredis/sets.py on lines 133..152
        tredis/sets.py on lines 403..422
        tredis/sortedsets.py on lines 236..255

        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 32.

        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 8 locations. Consider refactoring.
        Open

            def sdiffstore(self, destination, *keys):
                """This command is equal to :meth:`~tredis.RedisClient.sdiff`, but
                instead of returning the resulting set, it is stored in destination.
        
                If destination already exists, it is overwritten.
        Severity: Major
        Found in tredis/sets.py and 7 other locations - About 30 mins to fix
        tredis/lists.py on lines 120..150
        tredis/lists.py on lines 152..176
        tredis/lists.py on lines 195..224
        tredis/lists.py on lines 226..249
        tredis/sets.py on lines 133..152
        tredis/sets.py on lines 403..422
        tredis/sortedsets.py on lines 236..255

        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 32.

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

            def _pick_cluster_host(self, value):
                """Selects the Redis cluster host for the specified value.
        
                :param mixed value: The value to use when looking for the host
                :rtype: tredis.client._Connection
        Severity: Minor
        Found in tredis/client.py - 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