Showing 543 of 559 total issues

File finetuning_validator.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations
from typing import Dict, Text, Any, Optional
import copy
import logging

Severity: Minor
Found in rasa/graph_components/validators/finetuning_validator.py - About 2 hrs to fix

    File release.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Prepare a Rasa OSS release.
    
    - creates a release branch
    - creates a new changelog section in CHANGELOG.mdx based on all collected changes
    - increases the version number
    Severity: Minor
    Found in scripts/release.py - About 2 hrs to fix

      File hangouts.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import copy
      import logging
      import structlog
      import google.auth.transport.requests
      import cachecontrol
      Severity: Minor
      Found in rasa/core/channels/hangouts.py - About 2 hrs to fix

        File telegram.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import asyncio
        import json
        import logging
        from copy import deepcopy
        from sanic import Blueprint, response
        Severity: Minor
        Found in rasa/core/channels/telegram.py - About 2 hrs to fix

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

              def batch_to_model_data_format(
                  batch: MaybeNestedBatchData,
                  data_signature: Dict[Text, Dict[Text, List[FeatureSignature]]],
              ) -> Dict[Text, Dict[Text, List[tf.Tensor]]]:
                  """Convert input batch tensors into batch data format.
          Severity: Minor
          Found in rasa/utils/tensorflow/models.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 _feature_arrays_for_attribute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def _feature_arrays_for_attribute(
              attribute: Text,
              absent_features: List[Any],
              attribute_to_features: Dict[Text, List[List[List["Features"]]]],
              training: bool,
          Severity: Minor
          Found in rasa/utils/tensorflow/model_data_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 _fill_response_phrases has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def _fill_response_phrases(self) -> None:
                  """Set response phrase for all examples by looking up NLG stories."""
                  for example in self.training_examples:
                      # if intent_response_key is None, that means the corresponding intent is
                      # not a retrieval intent and hence no response text needs to be fetched.
          Severity: Minor
          Found in rasa/shared/nlu/training_data/training_data.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 split_events has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def split_events(
              events: Iterable["Event"],
              event_type_to_split_on: Type["Event"],
              additional_splitting_conditions: Optional[Dict[Text, Any]] = None,
              include_splitting_event: bool = True,
          Severity: Minor
          Found in rasa/shared/core/events.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 _issue_unused_checkpoint_notification has a Cognitive Complexity of 15 (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/shared/core/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 __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in rasa/utils/tensorflow/transformer.py - About 1 hr to fix

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

            def featurize_training_examples(
                training_examples: List[Message],
                attributes: List[Text],
                entity_tag_specs: Optional[List["EntityTagSpec"]] = None,
                featurizers: Optional[List[Text]] = None,
            Severity: Minor
            Found in rasa/utils/tensorflow/model_data_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 __init__ has 14 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Major
            Found in rasa/utils/tensorflow/layers.py - About 1 hr to fix

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

                  def visualize(self, output_file: Optional[Text] = None) -> "nx.MultiDiGraph":
                      import networkx as nx
                      from rasa.shared.core.training_data import visualization
                      from colorhash import ColorHash
              
              
              Severity: Minor
              Found in rasa/shared/core/training_data/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/shared/core/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 interactive has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              def interactive(args: argparse.Namespace) -> None:
                  _set_not_required_args(args)
                  file_importer = TrainingDataImporter.load_from_config(
                      args.config, args.domain, args.data if not args.core_only else [args.stories]
                  )
              Severity: Minor
              Found in rasa/cli/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 process_rule_step has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  def process_rule_step(self, rule_step: RuleStep) -> OrderedDict:
                      """Converts a RuleStep into an ordered dict.
              
                      Args:
                          rule_step: RuleStep object.
              Severity: Minor
              Found in rasa/shared/core/training_data/story_writer/yaml_story_writer.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 _compare_entities has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _compare_entities(
                      entity_predictions: List["EntityPrediction"],
                      entity_targets: List["EntityPrediction"],
                      i_pred: int,
                      i_target: int,
              Severity: Minor
              Found in rasa/core/test.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 14 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Major
              Found in rasa/core/tracker_store.py - About 1 hr to fix

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

                    def __init__(
                Severity: Major
                Found in rasa/core/brokers/kafka.py - About 1 hr to fix

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

                      def _line_number_for_path(self, current: Any, path: Text) -> Optional[int]:
                          """Get line number for a yaml path in the current content.
                  
                          Implemented using recursion: algorithm goes down the path navigating to the
                          leaf in the YAML tree. Unfortunately, not all nodes returned from the
                  Severity: Minor
                  Found in rasa/shared/utils/validation.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