anomalyDetectionTasks.py has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os import json import asyncio import traceback import logging
anomalyDetectionJob has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def anomalyDetectionJob(anomalyDef_id: int, manualRun: bool = False): """ Method to find initiate anomaly detection for a given anomaly definition :param anomalyDef_id: ID of the anomaly definition :param manualRun: Boolean determining whether task was manually initiated
- Read upRead up
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"
_anomalyDetectionSubTask has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _anomalyDetectionSubTask(dimValObj, dfDict, anomalyDefProps, detectionRuleType, detectionParams):