Showing 19 of 35 total issues

File grouped.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import collections
import itertools
import logging

import six
Severity: Minor
Found in kiel/clients/grouped.py - About 2 hrs to fix

    Function flush has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def flush(self):
            """
            Transforms the ``unsent`` structure to produce requests and sends them.
    
            The first order of business is to order the pending messages in
    Severity: Minor
    Found in kiel/clients/producer.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 process_topics has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_topics(self, response_topics):
            """
            Syncs the cluster's topic/partition metadata with a given response.
            Returns a set of topic names that were either missing data or had
            unknown leader IDs.
    Severity: Minor
    Found in kiel/cluster.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 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in kiel/clients/grouped.py - About 1 hr to fix

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

          def __init__(
      Severity: Major
      Found in kiel/clients/producer.py - About 1 hr to fix

        Function send has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def send(self, request_by_broker):
                """
                Sends a dict of requests keyed on broker ID and handles responses.
        
                Returns a dictionary of the results of
        Severity: Minor
        Found in kiel/clients/client.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 start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def start(self):
                """
                Establishes connections to the brokers in a cluster as well as
                gathers topic/partition metadata.
        
        
        Severity: Minor
        Found in kiel/cluster.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 handle_offset_commit_response has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def handle_offset_commit_response(self, response):
                """
                Handles responses from the "offset commit" api.
        
                For successful responses the affected topics are dropped from the set
        Severity: Minor
        Found in kiel/clients/grouped.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 handle_produce_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def handle_produce_response(self, response):
                """
                Handler for produce api responses, discards or retries as needed.
        
                For the "no error" result, the corresponding messages are discarded
        Severity: Minor
        Found in kiel/clients/producer.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

        Function consume has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def consume(self, topic, start=None):
                """
                Fetches from a given topics returns a list of deserialized values.
        
                If the given topic is not known to have synced offsets, a call to
        Severity: Minor
        Found in kiel/clients/consumer.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

        Function process_brokers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def process_brokers(self, brokers):
                """
                Syncs the ``self.conn`` connection dictionary with given broker
                metadata, returning a set of broker IDs that were in the metadata but
                had failing connections.
        Severity: Minor
        Found in kiel/cluster.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

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

            def __init__(
        Severity: Minor
        Found in kiel/clients/consumer.py - About 45 mins to fix

          Function determine_coordinator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def determine_coordinator(self):
                  """
                  Determines the ID of the broker that coordinates the group.
          
                  Uses the "consumer metadata" api to do its thing.  All brokers
          Severity: Minor
          Found in kiel/clients/grouped.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

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

              def __init__(
          Severity: Minor
          Found in kiel/zookeeper/allocator.py - About 35 mins to fix

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

                def parse(cls, buff, offset, size=None):
                    """
                    Given a buffer and offset, returns the parsed `MessageSet` and offset.
            
                    Starts by determining the size of the raw payload to parse, and
            Severity: Minor
            Found in kiel/protocol/messages.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 heal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def heal(self, response=None):
                    """
                    Syncs the state of the cluster with metadata retrieved from a broker.
            
                    If not response argument is given, a call to `get_metatadata()` fetches
            Severity: Minor
            Found in kiel/cluster.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 drain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def drain(iterable):
                """
                Helper method that empties an iterable as it is iterated over.
            
                Works for:
            Severity: Minor
            Found in kiel/iterables.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 handle_offset_fetch_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle_offset_fetch_response(self, response):
                    """
                    Handler for offset fetch api responses.
            
                    Sets the corresponding entry in the ``self.offsets`` structure for
            Severity: Minor
            Found in kiel/clients/grouped.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 handle_fetch_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle_fetch_response(self, response):
                    """
                    Handler for responses from the message "fetch" api.
            
                    Messages returned with the "no error" code are deserialized and
            Severity: Minor
            Found in kiel/clients/consumer.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