c137digital/unv_deploy

View on GitHub

Showing 8 of 32 total issues

Function _find_classes has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def _find_classes(self, modules, subclass):
        classes = []
        for module_path in modules:
            class_path = ''
            if ':' in module_path:
Severity: Minor
Found in src/unv/deploy/settings.py - About 3 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 servers has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def servers(self):
        if self._servers:
            return self._servers

        for scope, services in self.services.items():
Severity: Minor
Found in src/unv/deploy/providers/__init__.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 get_for_host has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_for_host(cls, host=None):
        settings = {}
        hosts_file = SETTINGS.settings_cache_file
        if hosts_file.exists():
            hosts = json.loads(hosts_file.read_text())
Severity: Minor
Found in src/unv/deploy/settings.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 get_all_manager_tasks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_all_manager_tasks(self, name: str = ''):
        for task_class in self._manager.tasks.values():
            task_name = task_class.get_namespace()
            if name and name != task_name:
                continue
Severity: Minor
Found in src/unv/deploy/tasks.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

Avoid deeply nested control flow statements.
Open

                        if mro.__name__ == subclass:
                            class_path = name
                            break

Severity: Major
Found in src/unv/deploy/settings.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if old_host != current_hosts[old_host['name']]:
                                changed = True
                    if vm_changed:
    Severity: Major
    Found in src/unv/deploy/providers/vagrant.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if scope != name:
                                  service_name = f"{scope}-{name}"
                              env = SETTINGS._data['env']
      Severity: Major
      Found in src/unv/deploy/providers/__init__.py - About 45 mins to fix

        Function _prepare_hosts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _prepare_hosts(self, task_class, name):
                method = getattr(task_class, name)
                is_nohost = getattr(method, '__nohost__', False)
                is_onehost = getattr(method, '__onehost__', False)
        
        
        Severity: Minor
        Found in src/unv/deploy/manager.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