rasa/core/test.py

Summary

Maintainability
F
3 days
Test Coverage
A
95%

File test.py has 1091 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import os
from pathlib import Path
import tempfile
import warnings as pywarnings
Severity: Major
Found in rasa/core/test.py - About 2 days to fix

    Function _compare_entities has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compare_entities(
            entity_predictions: List["EntityPrediction"],
            entity_targets: List["EntityPrediction"],
            i_pred: int,
            i_target: int,
    Severity: Minor
    Found in rasa/core/test.py - About 1 hr 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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in rasa/core/test.py - About 1 hr to fix

      Function _log_evaluation_table has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _log_evaluation_table(
      Severity: Major
      Found in rasa/core/test.py - About 1 hr to fix

        Function serialise has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def serialise(self) -> Tuple[PredictionList, PredictionList]:
                """Turn targets and predictions to lists of equal size for sklearn."""
                texts = sorted(
                    set(
                        [str(e.get("text", "")) for e in self.entity_targets]
        Severity: Minor
        Found in rasa/core/test.py - About 55 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 add_to_store has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def add_to_store(
        Severity: Major
        Found in rasa/core/test.py - About 50 mins to fix

          Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in rasa/core/test.py - About 50 mins to fix

            Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Minor
            Found in rasa/core/test.py - About 45 mins to fix

              Avoid too many return statements within this function.
              Open

                      return 1 if target else -1
              Severity: Major
              Found in rasa/core/test.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return 0
                Severity: Major
                Found in rasa/core/test.py - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status