rethinkdb/rethinkdb-python

View on GitHub

Showing 86 of 188 total issues

Function import_tables has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def import_tables(options, sources, files_ignored=None):
    # Make sure this isn't a pre-`reql_admin` cluster - which could result in data loss
    # if the user has a database named 'rethinkdb'
    utils_common.check_minimum_version(options, "1.6")

Severity: Minor
Found in rethinkdb/_import.py - About 1 hr to fix

    Function __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(
            self,
            conn_type,
            host,
            port,
    Severity: Minor
    Found in rethinkdb/net.py - About 55 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 _handleHandshake has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _handleHandshake(self, data):
            try:
                self.buf += data
                while True:
                    end_index = self.buf.find(b"\0")
    Severity: Minor
    Found in rethinkdb/twisted_net/net_twisted.py - About 55 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 sendall has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def sendall(self, data):
            offset = 0
            while offset < len(data):
                try:
                    offset += self._socket.send(data[offset:])
    Severity: Minor
    Found in rethinkdb/gevent_net/net_gevent.py - About 55 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 teardown has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def teardown(self):
    
            # - check the end of the file
            # note: fill_buffer should have guaranteed that we have only the data in the end
    
    
    Severity: Minor
    Found in rethinkdb/_import.py - About 55 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 _handleResponse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _handleResponse(self, data):
            # If we have more than one response, we should handle all of them.
            self.buf += data
            while True:
                # 1. Read the header, until we read the length of the awaited payload.
    Severity: Minor
    Found in rethinkdb/twisted_net/net_twisted.py - About 55 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 _dnsname_match has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _dnsname_match(domain_name, hostname, max_wildcards=1):
        """Matching according to RFC 6125, section 6.4.3
    
        http://tools.ietf.org/html/rfc6125#section-6.4.3
        """
    Severity: Minor
    Found in rethinkdb/backports/ssl_match_hostname/__init__.py - About 45 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 deeply nested control flow statements.
    Open

                        for dir_name in dirs[:]:  # iterate on a copy
                            if dir_name not in db_filter:
                                dirs.remove(dir_name)
                else:
    Severity: Major
    Found in rethinkdb/_import.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if _dnsname_match(value, hostname):
                              return
                          dnsnames.append(value)
      Severity: Major
      Found in rethinkdb/backports/ssl_match_hostname/__init__.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if str == unicode:
                                    info.append(json.dumps(row[field]))
                                else:
                                    info.append(json.dumps(row[field]).encode("utf-8"))
                        out_writer.writerow(info)
        Severity: Major
        Found in rethinkdb/_export.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if ext not in [".json", ".csv", ".info"]:
                                  files_ignored.append(os.path.join(root, filename))
                              elif ext == ".info":
                                  pass  # Info files are included based on the data files
                              elif not os.path.exists(os.path.join(root, table + ".info")):
          Severity: Major
          Found in rethinkdb/_import.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if item not in fields:
                                        del row[item]
                            if first:
            Severity: Major
            Found in rethinkdb/_export.py - About 45 mins to fix

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

              def make_connection(
                  connection_type,
                  host=None,
                  port=None,
                  db=None,
              Severity: Minor
              Found in rethinkdb/net.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 compose_carrots has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def compose_carrots(self, term, frames):
                      # This term is the cause of the error
                      if len(frames) == 0:
                          return ["^" for i in self.compose_term(term)]
              
              
              Severity: Minor
              Found in rethinkdb/errors.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 __iter__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __iter__(self):
                      itr = iter(self.seq)
              
                      try:
                          for sub in next(itr):
              Severity: Minor
              Found in rethinkdb/errors.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 parse_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_args(self, *args, **kwargs):
                      # - validate options
              
                      connect = True
                      if "connect" in kwargs:
              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

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

              def main(argv=None, prog=None):
                  options = parse_options(argv or sys.argv[1:], prog=prog)
                  start_time = time.time()
                  try:
                      rebuild_indexes(options)
              Severity: Minor
              Found in rethinkdb/_index_rebuild.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 set_loop_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def set_loop_type(self, library=None):
                      if library == "asyncio":
                          from rethinkdb.asyncio_net import net_asyncio
                          self.connection_type = net_asyncio.Connection
              
              
              Severity: Minor
              Found in rethinkdb/__init__.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 get_line has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_line(self):
                      """Return a line from the current _buffer_str, or raise NeedMoreData trying"""
              
                      # advance over any whitespace
                      self._buffer_pos = json.decoder.WHITESPACE.match(
              Severity: Minor
              Found in rethinkdb/_import.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

              Severity
              Category
              Status
              Source
              Language