RasaHQ/rasa_core

View on GitHub

Showing 216 of 245 total issues

Function training_states_and_actions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def training_states_and_actions(
        self,
        trackers: List[DialogueStateTracker],
        domain: Domain
    ) -> Tuple[List[List[Dict]], List[List[Text]]]:
Severity: Minor
Found in rasa/core/featurizers.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 _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 _issue_unused_checkpoint_notification has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _issue_unused_checkpoint_notification(
        self,
        unused_checkpoints: Set[Text]
    ) -> None:
        """Warns about unused story blocks.
Severity: Minor
Found in rasa/core/training/generator.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 _process_step has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _process_step(
        self,
        step: StoryStep,
        incoming_trackers: List[TrackerWithCachedStates]
    ) -> TrackersTuple:
Severity: Minor
Found in rasa/core/training/generator.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 call has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def call(self, inputs, state):
        """Perform a step of attention-wrapped RNN.

        The order has changed:
        - Step 1: Calculate attention inputs based on the previous cell state
Severity: Minor
Found in rasa/core/policies/tf_utils.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 slots_for_entities has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def slots_for_entities(self, entities):
        if self.store_entities_as_slots:
            slot_events = []
            for s in self.slots:
                if s.auto_fill:
Severity: Minor
Found in rasa/core/domain.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

Agent has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Agent(object):
    """The Agent class provides a convenient interface for the most important
     Rasa Core functionality.

     This includes training, handling messages, loading a dialogue model,
Severity: Minor
Found in rasa/core/agent.py - About 2 hrs to fix

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

        def __init__(self, cell,
    Severity: Major
    Found in rasa/core/policies/tf_utils.py - About 2 hrs to fix

      Function _chat_history_table has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def _chat_history_table(evts: List[Dict[Text, Any]]) -> Text:
          """Create a table containing bot and user messages.
      
          Also includes additional information, like any events and
          prediction probabilities."""
      Severity: Minor
      Found in rasa/core/training/interactive.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 persist_clean has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def persist_clean(self, filename: Text) -> None:
              """Write domain to a file.
      
               Strips redundant keys with default values."""
      
      
      Severity: Minor
      Found in rasa/core/domain.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 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

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

          def visualize(self, output_file=None):
              import networkx as nx
              from rasa.core.training import visualization
              from colorhash import ColorHash
      
      
      Severity: Minor
      Found in rasa/core/training/structures.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 _mark_first_action_in_story_steps_as_unpredictable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _mark_first_action_in_story_steps_as_unpredictable(self) -> None:
              """Mark actions which shouldn't be used during ML training.
      
              If a story starts with an action, we can not use
              that first action as a training example, as there is no
      Severity: Minor
      Found in rasa/core/training/generator.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

      Consider simplifying this complex logical expression.
      Open

                  if states[0] is not None and states[-1] is not None:
                      # explicitly set intents and actions before listen after
                      # which FormPolicy should not predict a form action and
                      # should add FormValidation(False) event
                      # @formatter:off
      Severity: Critical
      Found in tests/core/test_policies.py - About 1 hr to fix

        Function predict_action_probabilities has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def predict_action_probabilities(self,
                                             tracker: DialogueStateTracker,
                                             domain: Domain) -> List[float]:
                """Predicts the assigned action.
        
        
        Severity: Minor
        Found in rasa/core/policies/mapping_policy.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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, cell,
                         attention_mechanism,
                         sequence_len,
                         attn_shift_range=0,
                         sparse_attention=False,
        Severity: Minor
        Found in rasa/core/policies/tf_utils.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 _train_tf has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _train_tf(self,
                          session_data: SessionData,
                          loss: tf.Tensor,
                          mask: tf.Tensor) -> None:
                """Train tf graph."""
        Severity: Minor
        Found in rasa/core/policies/embedding_policy.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 _remove_duplicate_trackers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _remove_duplicate_trackers(self,
                                           trackers: List[TrackerWithCachedStates]
                                           ) -> TrackersTuple:
                """Removes trackers that create equal featurizations
                    for current story step.
        Severity: Minor
        Found in rasa/core/training/generator.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 format_bot_output has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def format_bot_output(
            message: Dict[Text, Any]
        ) -> Text:
            """Format a bot response to be displayed in the history table."""
        
        
        Severity: Minor
        Found in rasa/core/training/interactive.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 _warn_about_new_slots has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _warn_about_new_slots(self, tracker, action_name, events):
                # these are the events from that action we have seen during training
        
                if action_name not in self.policy_ensemble.action_fingerprints:
                    return
        Severity: Minor
        Found in rasa/core/processor.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

        Severity
        Category
        Status
        Source
        Language