File controllers.py
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os
import time
import traceback
from random import randrange
Function process
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def process(self):
# process sessions in increased intervals
if time.time() < self.next_check_ts:
return
self.update_next_check_ts(self.polling_interval_min, self.polling_interval_max)
- 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 process
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def process(self):
# process clusters in increased intervals
if time.time() < self.next_check_ts:
return
self.update_next_check_ts(self.polling_interval_min, self.polling_interval_max)
- 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 process_volume_restore_task
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process_volume_restore_task(self, task):
task_data = task.get('data')
driver = self.get_driver(task_data.get('tgt_cluster'))
if not driver:
raise RuntimeError(
- 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_driver
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_driver(self, cluster_name):
"""Create driver instance for given cluster.
We cache the driver instances to avoid login for every new request"""
cluster = None
for c in self.cluster_config['clusters']:
- 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 process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def process(self):
# process workspace management in increased intervals
if time.time() < self.next_check_ts:
return
self.update_next_check_ts(self.polling_interval_min, self.polling_interval_max)
- 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 __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, worker_id, config, cluster_config, client, controller_name):
Function process_volume_backup_task
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_volume_backup_task(self, task):
driver = self.get_driver(task.get('data').get('cluster'))
if not driver:
raise RuntimeError(
'No driver for cluster %s in task %s' % (task.get('data').get('cluster'), task.get('id')))
- 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"