kiel/cluster.py

Summary

Maintainability
A
3 hrs
Test Coverage

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 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 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 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

There are no issues that match your filters.

Category
Status