rethinkdb/rethinkdb-python

View on GitHub

Showing 188 of 188 total issues

Avoid too many return statements within this function.
Open

        return MakeArray(*val)
Severity: Major
Found in rethinkdb/ast.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return False
    Severity: Major
    Found in rethinkdb/ast.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return Datum(val)
      Severity: Major
      Found in rethinkdb/ast.py - About 30 mins to fix

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

            @gen.coroutine
            def server(self):
                res = yield ConnectionBase.server(self)
                raise gen.Return(res)
        Severity: Minor
        Found in rethinkdb/tornado_net/net_tornado.py and 1 other location - About 30 mins to fix
        rethinkdb/tornado_net/net_tornado.py on lines 304..307

        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

        Avoid too many return statements within this function.
        Open

                return obj
        Severity: Major
        Found in rethinkdb/ast.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return Datum(val)
          Severity: Major
          Found in rethinkdb/ast.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return Binary(val)
            Severity: Major
            Found in rethinkdb/ast.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return res.data[0]
              Severity: Major
              Found in rethinkdb/net.py - About 30 mins to fix

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

                        for query, async_res in iter(self._user_queries.values()):
                            async_res.set_exception(RqlDriverError(err_message))
                Severity: Minor
                Found in rethinkdb/gevent_net/net_gevent.py and 1 other location - About 30 mins to fix
                rethinkdb/tornado_net/net_tornado.py on lines 211..212

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

                    @gen.coroutine
                    def noreply_wait(self):
                        res = yield ConnectionBase.noreply_wait(self)
                        raise gen.Return(res)
                Severity: Minor
                Found in rethinkdb/tornado_net/net_tornado.py and 1 other location - About 30 mins to fix
                rethinkdb/tornado_net/net_tornado.py on lines 309..312

                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

                Avoid too many return statements within this function.
                Open

                        return MakeObj(obj)
                Severity: Major
                Found in rethinkdb/ast.py - About 30 mins to fix

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

                          for query, future in iter(self._user_queries.values()):
                              future.set_exception(ReqlDriverError(err_message))
                  Severity: Minor
                  Found in rethinkdb/tornado_net/net_tornado.py and 1 other location - About 30 mins to fix
                  rethinkdb/gevent_net/net_gevent.py on lines 261..262

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

                      def run_query(self, query, noreply):
                          self._socket.sendall(query.serialize(self._parent._get_json_encoder(query)))
                          if noreply:
                              return None
                  
                  
                  Severity: Minor
                  Found in rethinkdb/net.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

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

                      def __getitem__(self, index):
                          if isinstance(index, slice):
                              if index.stop:
                                  return Slice(self, index.start or 0, index.stop, bracket_operator=True)
                              else:
                  Severity: Minor
                  Found in rethinkdb/ast.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

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

                      def close(self, noreply_wait=False, token=None, exception=None):
                          self._closing = True
                          if exception is not None:
                              err_message = "Connection is closed (%s)." % str(exception)
                          else:
                  Severity: Minor
                  Found in rethinkdb/gevent_net/net_gevent.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

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

                      def fill_buffer(self):
                          if self._buffer_str is None:
                              self._buffer_str = ""
                              self._buffer_pos = 0
                              self._buffer_end = 0
                  Severity: Minor
                  Found in rethinkdb/_import.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

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

                      def fetch_next(self, wait=True):
                          timeout = Cursor._wait_to_timeout(wait)
                          deadline = None if timeout is None else time.time() + timeout
                  
                          def wait_canceller(d):
                  Severity: Minor
                  Found in rethinkdb/twisted_net/net_twisted.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

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

                      def get_line(self):
                          raw_row = next(self._reader)
                          if len(self._columns) != len(raw_row):
                              raise Exception(
                                  "Error: '%s' line %d has an inconsistent number of columns: %s"
                  Severity: Minor
                  Found in rethinkdb/_import.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

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

                      def conn(self, test_connection=True):
                          if not hasattr(self.__local, "connCache"):
                              self.__local.connCache = {}
                  
                          # check if existing connection is still good
                  Severity: Minor
                  Found in rethinkdb/utils_common.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

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

                      def __str__(self):
                          val_str = pprint.pformat(
                              [self.items[x] for x in range(min(10, len(self.items)))]
                              + (["..."] if len(self.items) > 10 else [])
                          )
                  Severity: Minor
                  Found in rethinkdb/net.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