wglass/lighthouse

View on GitHub
lighthouse/haproxy/balancer.py

Summary

Maintainability
B
5 hrs
Test Coverage

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

    def sync_nodes(self, clusters):
        """
        Syncs the enabled/disabled status of nodes existing in HAProxy based
        on the given clusters.

Severity: Minor
Found in lighthouse/haproxy/balancer.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 validate_proxies_config has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_proxies_config(cls, proxies):
        """
        Specific config validation method for the "proxies" portion of a
        config.

Severity: Minor
Found in lighthouse/haproxy/balancer.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 get_current_nodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_current_nodes(self, clusters):
        """
        Returns two dictionaries, the current nodes and the enabled nodes.

        The current_nodes dictionary is keyed off of the cluster name and
Severity: Minor
Found in lighthouse/haproxy/balancer.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 validate_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_config(cls, config):
        """
        Validates that a config file path and a control socket file path
        and pid file path are all present in the HAProxy config.
        """
Severity: Minor
Found in lighthouse/haproxy/balancer.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 apply_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_config(self, config):
        """
        Constructs HAProxyConfig and HAProxyControl instances based on the
        contents of the config.

Severity: Minor
Found in lighthouse/haproxy/balancer.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