rethinkdb/rethinkdb-python

View on GitHub

Showing 86 of 188 total issues

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

def abort(pools, exit_event):
    global _interrupt_seen

    if _interrupt_seen:
        # second time
Severity: Minor
Found in rethinkdb/utils_common.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

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

    def run(self, c=None, **global_optargs):
        if c is None:
            c = Repl.get()
            if c is None:
                if Repl.repl_active:
Severity: Minor
Found in rethinkdb/ast.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

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

        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

                Avoid too many return statements within this function.
                Open

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

                  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

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

                      def __repr__(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

                  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/tornado_net/net_tornado.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