rasa/core/test.py
File test.py
has 1091 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import logging
import os
from pathlib import Path
import tempfile
import warnings as pywarnings
Function _compare_entities
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def _compare_entities(
entity_predictions: List["EntityPrediction"],
entity_targets: List["EntityPrediction"],
i_pred: int,
i_target: int,
- 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 __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function _log_evaluation_table
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _log_evaluation_table(
Function serialise
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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]
- 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 add_to_store
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_to_store(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Avoid too many return
statements within this function. Open
Open
return 1 if target else -1
Avoid too many return
statements within this function. Open
Open
return 0