rethinkdb/rethinkdb-python

View on GitHub

Showing 86 of 188 total issues

RqlQuery has 138 functions (exceeds 20 allowed). Consider refactoring.
Open

class RqlQuery(object):
    # Instantiate this AST node with the given pos and opt args
    def __init__(self, *args, **optargs):
        self._args = [expr(e) for e in args]

Severity: Major
Found in rethinkdb/ast.py - About 2 days to fix

    Function parse_sources has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_sources(options, files_ignored=None):
        def parse_info_file(path):
            primary_key = None
            indexes = []
            write_hook = None
    Severity: Minor
    Found in rethinkdb/_import.py - About 2 days 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 import_tables has a Cognitive Complexity of 96 (exceeds 5 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 day 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_options has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_options(argv, prog=None):
        parser = utils_common.CommonOptionsParser(
            usage=usage, epilog=help_epilog, prog=prog
        )
    
    
    Severity: Minor
    Found in rethinkdb/_import.py - About 1 day 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 rebuild_indexes has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    def rebuild_indexes(options):
    
        # flesh out options.db_table
        if not options.db_table:
            options.db_table = [
    Severity: Minor
    Found in rethinkdb/_index_rebuild.py - About 7 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 __init__ has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, *args, **kwargs):
            # -- Type Checkers
    
            def check_tls_option(_, opt_str, value):
                value = str(value)
    Severity: Minor
    Found in rethinkdb/utils_common.py - About 6 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 table_writer has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def table_writer(
        tables, options, work_queue, error_queue, warning_queue, exit_event, timing_queue
    ):
        signal.signal(signal.SIGINT, signal.SIG_IGN)  # workers should ignore these
        db = table = batch = None
    Severity: Minor
    Found in rethinkdb/_import.py - About 5 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 __init__ has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, parent, timeout):
            self.host = parent._parent.host
            self.port = parent._parent.port
            self._read_buffer = None
            self._socket = None
    Severity: Minor
    Found in rethinkdb/net.py - About 4 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 export_table has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def export_table(
        db,
        table,
        directory,
        options,
    Severity: Minor
    Found in rethinkdb/_export.py - About 4 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 run has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def run(options):
        # 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/_export.py - About 4 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 match_hostname has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def match_hostname(cert, hostname):
        """Verify that *cert* (in decoded format as returned by
        SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
        rules are followed, but IP addresses are not accepted for *hostname*.
    
    
    Severity: Minor
    Found in rethinkdb/backports/ssl_match_hostname/__init__.py - About 3 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 do_unzip has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def do_unzip(temp_dir, options):
        """extract the tarfile to the filesystem"""
    
        tables_to_export = set(options.db_tables)
        top_level = None
    Severity: Minor
    Found in rethinkdb/_restore.py - About 3 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 parse_options has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_options(argv, prog=None):
        parser = utils_common.CommonOptionsParser(
            usage=usage, epilog=help_epilog, prog=prog
        )
    
    
    Severity: Minor
    Found in rethinkdb/_dump.py - About 3 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 __init__ has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, parent):
            self.host = parent._parent.host
            self.port = parent._parent.port
            self._read_buffer = None
            self._socket = None
    Severity: Minor
    Found in rethinkdb/gevent_net/net_gevent.py - About 3 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 json_writer has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def json_writer(filename, fields, task_queue, error_queue, format):
        try:
            with open(filename, "w") as out:
                first = True
                if format != "ndjson":
    Severity: Minor
    Found in rethinkdb/_export.py - About 3 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 recvall has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def recvall(self, length, deadline):
            res = b"" if self._read_buffer is None else self._read_buffer
            timeout = None if deadline is None else max(0, deadline - time.time())
            self._socket.settimeout(timeout)
            while len(res) < length:
    Severity: Minor
    Found in rethinkdb/net.py - About 3 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 run_clients has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def run_clients(options, workingDir, db_table_set):
        # Spawn one client for each db.table, up to options.clients at a time
        exit_event = multiprocessing.Event()
        processes = []
        if six.PY3:
    Severity: Minor
    Found in rethinkdb/_export.py - 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 main has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(argv=None, prog=None):
        options = parse_options(argv or sys.argv[1:], prog=prog)
        try:
            if not options.quiet:
                # Print a warning about the capabilities of dump, so no one is confused (hopefully)
    Severity: Minor
    Found in rethinkdb/_dump.py - 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 update_progress has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_progress(tables, debug, exit_event, sleep=0.2):
        signal.signal(signal.SIGINT, signal.SIG_IGN)  # workers should not get these
    
        # give weights to each of the tables based on file size
        totalSize = sum([x.bytes_size for x in tables])
    Severity: Minor
    Found in rethinkdb/_import.py - 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 connect has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def connect(self, timeout):
            deadline = None if timeout is None else self._io_loop.time() + timeout
    
            try:
                if len(self._parent.ssl) > 0:
    Severity: Minor
    Found in rethinkdb/tornado_net/net_tornado.py - 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

    Severity
    Category
    Status
    Source
    Language