RasaHQ/rasa_core

View on GitHub

Showing 216 of 245 total issues

Function first_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def first_key(d, default_key):
    if len(d) > 1:
        for k, v in d.items():
            if k != default_key:
                # we return the first key that is not the default key
Severity: Minor
Found in rasa/core/events/__init__.py - About 45 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

Avoid deeply nested control flow statements.
Open

                        if prob > best_intent_prob:
                            # finding the maximum confidence intent
                            if best_intent is not None:
                                # delete previous best intent
                                del bin_state[best_intent]
Severity: Major
Found in rasa/core/featurizers.py - About 45 mins to fix

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

        def __init__(self,
    Severity: Minor
    Found in rasa/core/channels/channel.py - About 45 mins to fix

      Function zero_state has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def zero_state(self, batch_size, dtype):
              """Modified  from tensorflow's zero_state
                  see there for description of the parameters"""
      
              # use AttentionWrapperState from superclass
      Severity: Minor
      Found in rasa/core/policies/tf_utils.py - About 45 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

      Avoid deeply nested control flow statements.
      Open

                          if (graph.has_node(j) and
                                  _nodes_are_equivalent(graph, i, j, max_history)):
                              # make sure we keep special styles
                              _transfer_style(graph.nodes(data=True)[j],
                                              graph.nodes(data=True)[i])
      Severity: Major
      Found in rasa/core/training/visualization.py - About 45 mins to fix

        Function create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def create(obj, endpoint=None):
                if isinstance(obj, NaturalLanguageInterpreter):
                    return obj
        
                if not isinstance(obj, str):
        Severity: Minor
        Found in rasa/core/interpreter.py - About 45 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 _remove_auxiliary_nodes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _remove_auxiliary_nodes(graph: 'networkx.MultiDiGraph',
                                    special_node_idx: int) -> None:
            """Remove any temporary or unused nodes."""
        
            graph.remove_node(TMP_NODE_ID)
        Severity: Minor
        Found in rasa/core/training/visualization.py - About 45 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 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

          def _add_edge(graph, u, v, key, label=None, **kwargs):
          Severity: Minor
          Found in rasa/core/training/visualization.py - About 45 mins to fix

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

                def add_to_store(
            Severity: Minor
            Found in rasa/core/test.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for cp in step.start_checkpoints:
                                          if cp.name == original_cp:
                                              if k == e:
                                                  cp_name = source_cp_name
                                              else:
              Severity: Major
              Found in rasa/core/training/structures.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (self.story_string_helper.form_validation and
                                                s.action_name ==
                                                self.story_string_helper.active_form):
                                            result += self._bot_string(
                                                ActionExecuted(ACTION_LISTEN_NAME))
                Severity: Major
                Found in rasa/core/training/structures.py - About 45 mins to fix

                  Function _split_conversation_at_restarts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def _split_conversation_at_restarts(
                      evts: List[Dict[Text, Any]]
                  ) -> List[List[Dict[Text, Any]]]:
                      """Split a conversation at restart events.
                  
                  
                  Severity: Minor
                  Found in rasa/core/training/interactive.py - About 45 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 add_to_store has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def add_to_store(
                              self,
                              action_predictions: Optional[List[str]] = None,
                              action_targets: Optional[List[str]] = None,
                              intent_predictions: Optional[List[str]] = None,
                  Severity: Minor
                  Found in rasa/core/test.py - About 45 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 run has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def run(model: Text, endpoints: Text, connector: Text = None,
                  Severity: Minor
                  Found in rasa/run.py - About 35 mins to fix

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

                        def __init__(self, url, team, user, pw, bot_channel):
                    Severity: Minor
                    Found in rasa/core/channels/mattermost.py - About 35 mins to fix

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

                          def test_cv_not_none_param_grid_none_triggers_search_without_params(
                      Severity: Minor
                      Found in tests/core/test_policies.py - About 35 mins to fix

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

                            def __init__(self,
                        Severity: Minor
                        Found in rasa/core/channels/socketio.py - About 35 mins to fix

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

                              def test_cv_not_none_param_grid_none_triggers_search_with_params(
                          Severity: Minor
                          Found in tests/core/test_policies.py - About 35 mins to fix

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

                            def test_stack_training(app,
                            Severity: Minor
                            Found in tests/core/test_server.py - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language