rasa/shared/core/events.py

Summary

Maintainability
F
5 days
Test Coverage
A
91%

File events.py has 1601 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import abc
import copy
import json
import logging
import structlog
Severity: Major
Found in rasa/shared/core/events.py - About 4 days to fix

    Function split_events has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def split_events(
        events: Iterable["Event"],
        event_type_to_split_on: Type["Event"],
        additional_splitting_conditions: Optional[Dict[Text, Any]] = None,
        include_splitting_event: bool = True,
    Severity: Minor
    Found in rasa/shared/core/events.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 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

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

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

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

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

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

              def _from_parse_data(
          Severity: Minor
          Found in rasa/shared/core/events.py - About 45 mins to fix

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

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

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

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

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

                    def __init__(
                Severity: Minor
                Found in rasa/shared/core/events.py - About 35 mins to fix

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

                      def __init__(
                  Severity: Minor
                  Found in rasa/shared/core/events.py - About 35 mins to fix

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

                        def __init__(
                    Severity: Minor
                    Found in rasa/shared/core/events.py - About 35 mins to fix

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

                      def deserialise_events(serialized_events: List[Dict[Text, Any]]) -> List["Event"]:
                          """Convert a list of dictionaries to a list of corresponding events.
                      
                          Example format:
                              [{"event": "slot", "value": 5, "name": "my_slot"}]
                      Severity: Minor
                      Found in rasa/shared/core/events.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

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

                          def resolve_by_type(
                              type_name: Text, default: Optional[Type["Event"]] = None
                          ) -> Optional[Type["Event"]]:
                              """Returns a slots class by its type name."""
                              for cls in rasa.shared.utils.common.all_subclasses(Event):
                      Severity: Minor
                      Found in rasa/shared/core/events.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(
                              self,
                              text: Optional[Text] = None,
                              intent: Optional[Dict] = None,
                              entities: Optional[List[Dict]] = None,
                      Severity: Minor
                      Found in rasa/shared/core/events.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

                      There are no issues that match your filters.

                      Category
                      Status