brndnmtthws/mother-of-dragons

View on GitHub

Showing 3 of 22 total issues

Function get_config_for_this_dragon has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def get_config_for_this_dragon(self, configs):
        # Condition 1: find config where both model and MAC matches
        for c in configs:
            if 'apply_to' in c and \
                'models' in c['apply_to'] and \
Severity: Minor
Found in mother_of_dragons/dragons.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 fetch_stats_for_dragon has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def fetch_stats_for_dragon(self, host):
        """Fetch stats for a dragon and schedule the next fetch."""
        if host in self.dragons:
            try:
                dragon = self.dragons[host]
Severity: Minor
Found in mother_of_dragons/mother.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 check_and_update_autotune has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def check_and_update_autotune(self):
        """Check current autotune setting and update if necessary."""
        autotune = self.dragon.getAutoTune()
        if 'autoTuneMode' in autotune:
            if 'mode' in autotune['autoTuneMode'] and 'level' in autotune['autoTuneMode']:
Severity: Minor
Found in mother_of_dragons/dragons.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

Severity
Category
Status
Source
Language