Showing 558 of 559 total issues

File lexical_syntactic_featurizer.py has 465 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations
import logging
from collections import OrderedDict

import scipy.sparse

    File train_utils.py has 461 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from pathlib import Path
    import numpy as np
    from typing import Optional, Text, Dict, Any, Union, List, Tuple, TYPE_CHECKING
    
    import rasa.shared.utils.common
    Severity: Minor
    Found in rasa/utils/train_utils.py - About 7 hrs to fix

      File importer.py has 457 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from abc import ABC, abstractmethod
      from functools import reduce
      from typing import Text, Optional, List, Dict, Set, Any, Tuple, Type, Union, cast
      import logging
      
      
      Severity: Minor
      Found in rasa/shared/importers/importer.py - About 7 hrs to fix

        File agent.py has 446 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from __future__ import annotations
        from asyncio import AbstractEventLoop, CancelledError
        import functools
        import logging
        import os
        Severity: Minor
        Found in rasa/core/agent.py - About 6 hrs to fix

          Function with_cycles_removed has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              def with_cycles_removed(self) -> "StoryGraph":
                  """Create a graph with the cyclic edges removed from this graph."""
                  story_end_checkpoints = self.story_end_checkpoints.copy()
                  cyclic_edge_ids = self.cyclic_edge_ids
                  # we need to remove the start steps and replace them with steps ending
          Severity: Minor
          Found in rasa/shared/core/training_data/structures.py - About 6 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 default_recipe_validator.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from __future__ import annotations
          from collections import defaultdict
          from typing import Iterable, List, Dict, Text, Any, Set, Type, cast
          
          from rasa.core.featurizers.precomputation import CoreFeaturizationInputConverter
          Severity: Minor
          Found in rasa/graph_components/validators/default_recipe_validator.py - About 6 hrs to fix

            Function format_tracker_states has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

                def format_tracker_states(states: List[Dict]) -> Text:
                    """Format tracker states to human readable format on debug log.
            
                    Args:
                        states: list of tracker states dicts
            Severity: Minor
            Found in rasa/core/policies/policy.py - About 6 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 common.py has 434 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import copy
            import inspect
            import logging
            import logging.config
            import logging.handlers
            Severity: Minor
            Found in rasa/utils/common.py - About 6 hrs to fix

              File memoization.py has 431 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              from __future__ import annotations
              import copy
              import zlib
              
              import base64
              Severity: Minor
              Found in rasa/core/policies/memoization.py - About 6 hrs to fix

                Function process_user_utterance has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                Open

                    def process_user_utterance(
                        user_utterance: UserUttered, is_test_story: bool = False
                    ) -> OrderedDict:
                        """Converts a single user utterance into an ordered dict.
                
                
                Severity: Minor
                Found in rasa/shared/core/training_data/story_writer/yaml_story_writer.py - About 6 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 message.py has 399 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from typing import Any, Optional, Tuple, Text, Dict, Set, List
                
                import typing
                import copy
                
                
                Severity: Minor
                Found in rasa/shared/nlu/training_data/message.py - About 5 hrs to fix

                  Function visualize_neighborhood has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def visualize_neighborhood(
                      current: Optional[List[Event]],
                      event_sequences: List[List[Event]],
                      output_file: Optional[Text] = None,
                      max_history: int = 2,
                  Severity: Minor
                  Found in rasa/shared/core/training_data/visualization.py - About 5 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 model_training.py has 389 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import time
                  from pathlib import Path
                  from typing import Text, NamedTuple, Optional, List, Union, Dict, Any
                  
                  import randomname
                  Severity: Minor
                  Found in rasa/model_training.py - About 5 hrs to fix

                    File model_data_utils.py has 386 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import typing
                    import copy
                    import numpy as np
                    import scipy.sparse
                    from collections import defaultdict, OrderedDict
                    Severity: Minor
                    Found in rasa/utils/tensorflow/model_data_utils.py - About 5 hrs to fix

                      File extractor.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import abc
                      from typing import Any, Dict, List, NamedTuple, Text, Tuple, Optional
                      
                      import rasa.shared.utils.io
                      from rasa.shared.constants import DOCS_URL_TRAINING_DATA_NLU
                      Severity: Minor
                      Found in rasa/nlu/extractors/extractor.py - About 5 hrs to fix

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

                        from __future__ import annotations
                        
                        import abc
                        import logging
                        import os
                        Severity: Minor
                        Found in rasa/engine/caching.py - About 5 hrs to fix

                          File model_testing.py has 367 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import copy
                          import logging
                          import os
                          from typing import (
                              Text,
                          Severity: Minor
                          Found in rasa/model_testing.py - About 4 hrs to fix

                            File slots.py has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import logging
                            from abc import ABC, abstractmethod
                            from typing import Any, Dict, List, Optional, Text, Type
                            
                            import rasa.shared.core.constants
                            Severity: Minor
                            Found in rasa/shared/core/slots.py - About 4 hrs to fix

                              Function requires_auth has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def requires_auth(
                                  app: Sanic, token: Optional[Text] = None
                              ) -> Callable[["SanicView"], "SanicView"]:
                                  """Wraps a request handler with token authentication."""
                              
                              
                              Severity: Minor
                              Found in rasa/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

                              File crf.py has 354 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import tensorflow as tf
                              from tensorflow import TensorShape
                              from tensorflow.types.experimental import TensorLike
                              from typing import Tuple, Any, List, Union, Optional
                              
                              
                              Severity: Minor
                              Found in rasa/utils/tensorflow/crf.py - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language