cuebook/CueObserve

View on GitHub

Showing 37 of 54 total issues

Function detect has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def detect(df, granularity, detectionRuleType, detectionParams, limit=None):
Severity: Minor
Found in api/ops/tasks/detection/core/anomalyDetection.py - About 35 mins to fix

    Function valueThresholdDetect has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def valueThresholdDetect(df, granularity, operator, value1, value2):
    Severity: Minor
    Found in api/ops/tasks/detection/core/detectionTypes/valueThreshold.py - About 35 mins to fix

      Function _anomalyDetectionForValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _anomalyDetectionForValue(
      Severity: Minor
      Found in api/ops/tasks/rootCauseAnalysis.py - About 35 mins to fix

        Function topNDimensionalValues has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def topNDimensionalValues(
        Severity: Minor
        Found in api/access/utils.py - About 35 mins to fix

          Function minAvgValueOnDimensionalValues has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def minAvgValueOnDimensionalValues(
          Severity: Minor
          Found in api/access/utils.py - About 35 mins to fix

            Function anomalyService has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def anomalyService(dimValObj, dfDict, anomalyDefProps, detectionRuleType, detectionParams):
            Severity: Minor
            Found in api/ops/tasks/detection/core/anomalyDetection.py - About 35 mins to fix

              Function webhookAlertHelper has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def webhookAlertHelper(
              Severity: Minor
              Found in api/anomaly/services/alerts.py - About 35 mins to fix

                Function webookAnomalyAlert has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def webookAnomalyAlert(url, message, details, subject, anomalyDefId, anomalyId):
                Severity: Minor
                Found in api/anomaly/services/alerts.py - About 35 mins to fix

                  Function minAvgValueOnDimensionalValuesNonRollup has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def minAvgValueOnDimensionalValuesNonRollup(
                  Severity: Minor
                  Found in api/access/utils.py - About 35 mins to fix

                    Function _anomalyDetectionSubTask has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def _anomalyDetectionSubTask(dimValObj, dfDict, anomalyDefProps, detectionRuleType, detectionParams):
                    Severity: Minor
                    Found in api/ops/tasks/anomalyDetectionTasks.py - About 35 mins to fix

                      Function checkLatestAnomaly has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def checkLatestAnomaly(df):
                          """
                          Looks up latest anomaly in dataframe
                          """
                          anomalies = df[df["anomaly"] == 15]
                      Severity: Minor
                      Found in api/ops/tasks/detection/core/detectionTypes/prophet.py - About 35 mins to fix

                      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
                      Severity: Major
                      Found in api/app/middlewares.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return HttpResponse('Unauthorized', status=401)
                        Severity: Major
                        Found in api/app/middlewares.py - About 30 mins to fix

                          Function getInstallationId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def getInstallationId():
                              """ Function to get installation, if exists or create one"""
                              try:
                                  res = ApiResponse()
                                  userId = ''.join(random.choices(string.ascii_uppercase + string.digits, k=16))
                          Severity: Minor
                          Found in api/anomaly/services/telemetry.py - About 25 mins to fix

                          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 editAnomalyDefinition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def editAnomalyDefinition(
                                  anomalyId: int = 0, highOrLow: str = None, detectionRuleParams: dict = {}
                              ):
                                  """
                                  Update anomaly objects of given anomalyId
                          Severity: Minor
                          Found in api/anomaly/services/anomalyDefinitions.py - About 25 mins to fix

                          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 webhookAlertHelper has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def webhookAlertHelper(
                                  name,
                                  subject,
                                  message,
                                  details="",
                          Severity: Minor
                          Found in api/anomaly/services/alerts.py - About 25 mins to fix

                          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 sortOnAnomalyDefinition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def sortOnAnomalyDefinition(anomalyDefObjs: List[AnomalyDefinition], sorter):
                                  """
                                  Sort Anomaly Definition on given user column
                                  """
                                  columnToSort = sorter.get("columnKey", "")
                          Severity: Minor
                          Found in api/anomaly/services/anomalyDefinitions.py - About 25 mins to fix

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language