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:
- Read upRead up
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():
- Read upRead up
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())
- Read upRead up
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
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if old_host != current_hosts[old_host['name']]:
changed = True
if vm_changed:
Avoid deeply nested control flow statements. Open
if scope != name:
service_name = f"{scope}-{name}"
env = SETTINGS._data['env']
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)
- Read upRead up
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"