odin-detector/odin-data

View on GitHub
python/src/odin_data/control/odin_data_controller.py

Summary

Maintainability
D
2 days
Test Coverage

Function create_demand_config has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def create_demand_config(self, new_params, old_params):
        config = None
        for item in new_params:
            logging.debug("Param: {}".format(item))
            logging.debug("   Type: {}".format(type(new_params[item])))
Severity: Minor
Found in python/src/odin_data/control/odin_data_controller.py - About 7 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 update_loop has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def update_loop(self):
        """Handle background update loop tasks.
        This method handles background update tasks executed periodically in the tornado
        IOLoop instance. This includes requesting the status from the underlying application
        and preparing the JSON encoded reply in a format that can be easily parsed.
Severity: Minor
Found in python/src/odin_data/control/odin_data_controller.py - About 4 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 process_config_changes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def process_config_changes(self):
        """Search through the application config trees and compare with the
        latest cached version.  Any changes should be built into a new config
        message and sent down to the applications.
        This method must be called after the set method is called and needs to
Severity: Minor
Found in python/src/odin_data/control/odin_data_controller.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

Avoid deeply nested control flow statements.
Open

                        if config is None:
                            config = {}
                        config[item] = diff
Severity: Major
Found in python/src/odin_data/control/odin_data_controller.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if isinstance(new_item, dict):
                                config[item].append(
                                    self.create_demand_config(new_item, old_item)
                                )
                            else:
    Severity: Major
    Found in python/src/odin_data/control/odin_data_controller.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if config is None:
                                  config = {}
                              config[item] = new_params[item]
      Severity: Major
      Found in python/src/odin_data/control/odin_data_controller.py - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status