RasaHQ/rasa_core

View on GitHub
rasa/core/trackers.py

Summary

Maintainability
D
2 days
Test Coverage

DialogueStateTracker has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

class DialogueStateTracker(object):
    """Maintains the state of a conversation.

    The field max_event_history will only give you these last events,
    it can be set in the tracker_store"""
Severity: Minor
Found in rasa/core/trackers.py - About 5 hrs to fix

    File trackers.py has 372 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import typing
    from collections import deque
    
    import copy
    import io
    Severity: Minor
    Found in rasa/core/trackers.py - About 4 hrs to fix

      Function generate_all_prior_trackers has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          def generate_all_prior_trackers(self):
              # type: () -> Generator[DialogueStateTracker, None, None]
              """Returns a generator of the previous trackers of this tracker.
      
              The resulting array is representing
      Severity: Minor
      Found in rasa/core/trackers.py - About 4 hrs 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 applied_events has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def applied_events(self) -> List[Event]:
              """Returns all actions that should be applied - w/o reverted events."""
      
              def undo_till_previous(event_type, done_events):
                  """Removes events from `done_events` until `event_type` is
      Severity: Minor
      Found in rasa/core/trackers.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

      There are no issues that match your filters.

      Category
      Status