RasaHQ/rasa_core

View on GitHub

Showing 216 of 245 total issues

File action.py has 375 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import aiohttp
import copy
import json

import logging
Severity: Minor
Found in rasa/core/actions/action.py - About 5 hrs to fix

    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 processor.py has 374 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import json
      import logging
      from types import LambdaType
      from typing import Any, Dict, List, Optional, Text, Tuple
      
      
      Severity: Minor
      Found in rasa/core/processor.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 requires_auth has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

          def requires_auth(app: Sanic,
                            token: Optional[Text] = None
                            ) -> Callable[[Any], Any]:
              """Wraps a request handler with token authentication."""
          
          
          Severity: Minor
          Found in rasa/core/server.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 check_domain_sanity has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

          def check_domain_sanity(domain):
              """Make sure the domain is properly configured.
          
              Checks the settings and checks if there are duplicate actions,
              intents, slots and entities."""
          Severity: Minor
          Found in rasa/core/domain.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 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 _merge_equivalent_nodes has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          def _merge_equivalent_nodes(graph, max_history):
              """Searches for equivalent nodes in the graph and merges them."""
          
              changed = True
              # every node merge changes the graph and can trigger previously
          Severity: Minor
          Found in rasa/core/training/visualization.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

          File test_trackers.py has 331 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import json
          
          import fakeredis
          import pytest
          import tempfile
          Severity: Minor
          Found in tests/core/test_trackers.py - About 3 hrs to fix

            Function _create_states has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                def _create_states(self,
                                   tracker: DialogueStateTracker,
                                   domain: Domain,
                                   is_binary_training: bool = False
                                   ) -> List[Dict[Text, float]]:
            Severity: Minor
            Found in rasa/core/featurizers.py - About 3 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

            File dsl.py has 322 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            import asyncio
            import io
            import json
            import logging
            Severity: Minor
            Found in rasa/core/training/dsl.py - About 3 hrs to fix

              File channel.py has 311 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import asyncio
              from asyncio import Queue, CancelledError
              
              import inspect
              import json
              Severity: Minor
              Found in rasa/core/channels/channel.py - About 3 hrs to fix

                File ensemble.py has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import importlib
                import json
                import logging
                import os
                import sys
                Severity: Minor
                Found in rasa/core/policies/ensemble.py - About 3 hrs to fix

                  File test_server.py has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  import json
                  import os
                  import tempfile
                  import uuid
                  Severity: Minor
                  Found in tests/core/test_server.py - About 3 hrs to fix

                    Function get_parsing_states has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_parsing_states(self,
                                               tracker: 'DialogueStateTracker'
                                               ) -> Dict[Text, float]:
                    
                            state_dict = {}
                    Severity: Minor
                    Found in rasa/core/domain.py - About 3 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 training_states_and_actions has a Cognitive Complexity of 22 (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 3 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 encode has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def encode(self, state: Dict[Text, float]) -> np.ndarray:
                            if not self.num_features:
                                raise Exception("LabelTokenizerSingleStateFeaturizer "
                                                "was not prepared before encoding.")
                    
                    
                    Severity: Minor
                    Found in rasa/core/featurizers.py - About 3 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 __init__ has 24 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(
                    Severity: Major
                    Found in rasa/core/policies/embedding_policy.py - About 3 hrs to fix

                      File tracker_store.py has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import itertools
                      import json
                      import logging
                      import pickle
                      # noinspection PyPep8Naming
                      Severity: Minor
                      Found in rasa/core/tracker_store.py - About 2 hrs to fix

                        Function blueprint has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def blueprint(self, on_new_message):
                                telegram_webhook = Blueprint('telegram_webhook', __name__)
                                out_channel = TelegramOutput(self.access_token)
                        
                                @telegram_webhook.route("/", methods=['GET'])
                        Severity: Minor
                        Found in rasa/core/channels/telegram.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

                        Severity
                        Category
                        Status
                        Source
                        Language