wglass/zoonado

View on GitHub

Showing 21 of 49 total issues

Function read_loop has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def read_loop(self):
        """
        Infinite loop that reads messages off of the socket while not closed.

        When a message is received its corresponding pending Future is set
Severity: Minor
Found in zoonado/connection.py - About 1 hr 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 find_server has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def find_server(self, allow_read_only):
        conn = None

        retry_policy = RetryPolicy.exponential_backoff(maximum=MAX_FIND_WAIT)

Severity: Minor
Found in zoonado/session.py - About 1 hr 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 wait_in_line has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def wait_in_line(self, znode_label, timeout=None, blocked_by=None):
        time_limit = None
        if timeout is not None:
            time_limit = time.time() + timeout

Severity: Minor
Found in zoonado/recipes/base_lock.py - About 1 hr 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 repair_loop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def repair_loop(self):
        while not self.closing:
            yield self.state.wait_for(States.SUSPENDED, States.LOST)
            if self.closing:
                break
Severity: Minor
Found in zoonado/session.py - About 1 hr 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 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in zoonado/client.py - About 1 hr to fix

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

        def ensure_path(self, path, acl=None):
            acl = acl or self.default_acl
    
            paths_to_make = []
            for segment in path[1:].split("/"):
    Severity: Minor
    Found in zoonado/client.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 leave has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def leave(self, timeout=None):
            log.debug("Leaving double barrier %s", self.base_path)
            time_limit = None
            if timeout is not None:
                time_limit = time.time() + timeout
    Severity: Minor
    Found in zoonado/recipes/double_barrier.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 event_dispatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def event_dispatch(self, event):
            log.debug("Got watch event: %s", event)
    
            if event.type:
                key = (event.type, event.path)
    Severity: Minor
    Found in zoonado/session.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 make has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def make(
    Severity: Major
    Found in zoonado/protocol/acl.py - About 50 mins to fix

      Function create has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def create(
      Severity: Minor
      Found in zoonado/client.py - About 45 mins to fix

        Function create has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create(
        Severity: Minor
        Found in zoonado/transaction.py - About 45 mins to fix

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

              def __init__(self, path, defaults, client, data_watcher, child_watcher):
          Severity: Minor
          Found in zoonado/recipes/tree_cache.py - About 35 mins to fix

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

            def worker(number, client, znode_path, allocation_fn, items):
            Severity: Minor
            Found in examples/allocator.py - About 35 mins to fix

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

                  def set_perms(self, read, write, create, delete, admin):
              Severity: Minor
              Found in zoonado/protocol/acl.py - About 35 mins to fix

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

                    def gather_installed_classes(self):
                        for entry_point in pkg_resources.iter_entry_points(ENTRY_POINT):
                            try:
                                recipe_class = entry_point.load()
                            except ImportError as e:
                Severity: Minor
                Found in zoonado/recipes/proxy.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 send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def send(self, request, xid=None):
                        f = concurrent.Future()
                
                        if self.closing:
                            f.set_exception(exc.ConnectError(self.host, self.port))
                Severity: Minor
                Found in zoonado/connection.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_existing_watches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def set_existing_watches(self):
                        if not self.watch_callbacks:
                            return
                
                        request = protocol.SetWatchesRequest(
                Severity: Minor
                Found in zoonado/session.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 commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def commit(self):
                        if not self.request.requests:
                            raise ValueError("No operations to commit.")
                
                        response = yield self.client.send(self.request)
                Severity: Minor
                Found in zoonado/transaction.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 __str__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __str__(self):
                
                        def subpart_string(part_info):
                            part_name, part_class = part_info
                
                
                Severity: Minor
                Found in zoonado/protocol/part.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 enforce has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def enforce(self, request=None):
                        self.timings[id(request)].append(time.time())
                
                        tries = len(self.timings[id(request)])
                        if tries == 1:
                Severity: Minor
                Found in zoonado/retry.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