Showing 53 of 66 total issues
Function measure_network
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def measure_network(self, metric, args):
'''
Returns a measurement of the desired network interface and metric
'''
try:
- 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 queue_exists
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def queue_exists(component, metric, args):
""" Checks whether the specified queue already exists """
if component in realtime_queues:
if args is not None:
if args in realtime_queues[component] and metric in realtime_queues[component][args]:
- 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 set_gathering_rates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_gathering_rates(cls):
from misc import queue_manager
component_metrics_writer_reader = UnifiedDatabaseInterface.get_component_metrics_writer_reader()
if not component_metrics_writer_reader.are_gathering_rates_set():
- 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_condensed_data
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_condensed_data(cls, component_type: str, component_arg: str, metric_name: str, start_time: int,
Function __on_measurement_received
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __on_measurement_received(self, component_type: str, component_arg: str, metric: str, timestamp: int,
Function broadcast_new_measurement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def broadcast_new_measurement(cls, component_type: str, component_arg: str, metric: str, timestamp: int,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, component, metric, args, delayms, event=None):
Function insert_measurement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def insert_measurement(self, component_type, component_arg, metric_name, timestamp, value):
Function broadcast_new_measurement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def broadcast_new_measurement(cls, component_type: str, component_arg: str, metric: str, timestamp: int,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, uri=None, http_method=None, headers=None, params=None, body=None):
Function read_measurement_from_queue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def read_measurement_from_queue(component, metric, args=None, blocking=False,
Function __get_api_paths
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __get_api_paths(cls, base_api_path, sub_paths, version, is_current):
Function hardwareAdded
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def hardwareAdded(hardware):
print(hardware.Name)
print(hardware.GetReport())
for sensor in hardware.Sensors:
print(typeList[sensor.SensorType])
- 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 write_error
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def write_error(self, status_code, **kwargs) -> None:
"""
Overrides the built-in function to implement custom error responses.
If in debug mode and caused by an uncaught exception this will add the stacktrace to the error response.
- 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 __is_mandatory_parameter_valid
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __is_mandatory_parameter_valid(self, mandatory_parameter):
parameter_name = mandatory_parameter[0]
verification_function = mandatory_parameter[1]
params = self._request_holder.get_params()
- 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 _put
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _put(self) -> bool:
request_body = self._request_holder.get_body()
component_metrics_dict = self.__get_all_component_metrics()
- 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_measurement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_measurement(self, component, metric, args):
'''
Retrieves a measurement from the measuring source
given the component, metric and optionally arguments
'''
- 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 rate_update_valid
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rate_update_valid(rate_update):
"""
Checks the given rate_update for the correct data structure
Returns True if it has the right structure
"""
- 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_cpu_measurement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_cpu_measurement(self, metric, args):
"""
Updates the hardware class for the specified cpu (not cores, whole cpu socket)
and returns the value for the specified metric
"""
- 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 too many return
statements within this function. Open
return False