File provider_v2.py
has 796 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import json
import logging
import threading
import uuid
CloudwatchProvider
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class CloudwatchProvider(CloudwatchApi, ServiceLifecycleHook):
"""
Cloudwatch provider.
LIMITATIONS:
Function set_alarm_state
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def set_alarm_state(
self,
context: RequestContext,
alarm_name: AlarmName,
state_value: StateValue,
- 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_metric_statistics
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_metric_statistics(
self,
context: RequestContext,
namespace: Namespace,
metric_name: MetricName,
- 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_metric_alarm
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def put_metric_alarm(self, context: RequestContext, request: PutMetricAlarmInput) -> None:
# missing will be the default, when not set (but it will not explicitly be set)
if request.get("TreatMissingData", "missing") not in [
"breaching",
"notBreaching",
- 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_metric_statistics
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_metric_statistics(
Function describe_alarms
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def describe_alarms(
Function get_metric_data
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_metric_data(
self,
context: RequestContext,
metric_data_queries: MetricDataQueries,
start_time: Timestamp,
- 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 _validate_parameters_for_put_metric_data
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _validate_parameters_for_put_metric_data(metric_data: MetricData) -> None:
for index, metric_item in enumerate(metric_data):
indexplusone = index + 1
if metric_item.get("Value") and metric_item.get("Values"):
raise InvalidParameterCombinationException(
- 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 describe_alarm_history
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def describe_alarm_history(
Function get_metric_data
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_metric_data(
Function list_metrics
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_metrics(
Function describe_alarms_for_metric
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def describe_alarms_for_metric(
Function set_alarm_state
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_alarm_state(
Function _update_state
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _update_state(
Function describe_alarm_history
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def describe_alarm_history(
self,
context: RequestContext,
alarm_name: AlarmName = None,
alarm_types: AlarmTypes = None,
- 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"