RasaHQ/rasa_core

View on GitHub
rasa/core/policies/memoization.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function _add_states_to_lookup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _add_states_to_lookup(self, trackers_as_states, trackers_as_actions,
                              domain, online=False):
        """Add states to lookup dict"""
        if not trackers_as_states:
            return
Severity: Minor
Found in rasa/core/policies/memoization.py - About 2 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 _back_to_the_future_again has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _back_to_the_future_again(tracker):
        """Send Marty to the past to get
            the new featurization for the future"""

        idx_of_first_action = None
Severity: Minor
Found in rasa/core/policies/memoization.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

Avoid deeply nested control flow statements.
Open

                        if online:
                            logger.info("Original stories are "
                                        "different for {} -- {}\n"
                                        "Memorized the new ones for "
                                        "now. Delete contradicting "
Severity: Major
Found in rasa/core/policies/memoization.py - About 45 mins to fix

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

        def _recall_using_delorean(self, old_states, tracker, domain):
            """Recursively go to the past to correctly forget slots,
                and then back to the future to recall."""
    
            logger.debug("Launch DeLorean...")
    Severity: Minor
    Found in rasa/core/policies/memoization.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 predict_action_probabilities has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def predict_action_probabilities(self,
                                         tracker: DialogueStateTracker,
                                         domain: Domain) -> List[float]:
            """Predicts the next action the bot should take
                after seeing the tracker.
    Severity: Minor
    Found in rasa/core/policies/memoization.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