Showing 543 of 559 total issues

Function process_training_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def process_training_data(self, training_data: TrainingData) -> TrainingData:
        """Tokenize all training data."""
        for example in training_data.training_examples:
            for attribute in MESSAGE_ATTRIBUTES:
                if (
Severity: Minor
Found in rasa/nlu/tokenizers/tokenizer.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 _replace_edge_labels_with_nodes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _replace_edge_labels_with_nodes(
    graph: "networkx.MultiDiGraph", next_id: int, nlu_training_data: "TrainingData"
) -> None:
    """Replaces edge labels with nodes.

Severity: Minor
Found in rasa/shared/core/training_data/visualization.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 12 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        tracker_store: TrackerStore,
        strategy: str,
        count: Optional[int] = None,
Severity: Minor
Found in rasa/core/evaluation/marker_tracker_loader.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 _add_bilou_tags_to_entities has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _add_bilou_tags_to_entities(
    bilou: List[Text],
    entities: List[Tuple[int, int, Text]],
    end_pos_to_token_idx: Dict[int, int],
    start_pos_to_token_idx: Dict[int, int],
Severity: Minor
Found in rasa/nlu/utils/bilou_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 _check_OOV_present has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _check_OOV_present(self, all_tokens: List[List[Text]], attribute: Text) -> None:
        """Check if an OOV word is present."""
        if not self.OOV_token or self.OOV_words or not all_tokens:
            return

Severity: Minor
Found in rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.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 plot_paired_histogram has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

def plot_paired_histogram(
Severity: Major
Found in rasa/utils/plotting.py - About 1 hr to fix

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

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

      Function parse_changelog has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def parse_changelog(tag_name: Text) -> Text:
          """Read the changelog and extract the most recently release entry."""
      
          p = Path(__file__).parent.parent / "CHANGELOG.mdx"
          changelog_lines = p.read_text(encoding="UTF-8").splitlines()
      Severity: Minor
      Found in scripts/publish_gh_release_notes.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 __str__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self) -> Text:
              msg = ""
              if self.filename:
                  msg += f"Failed to validate '{self.filename}'. "
              else:
      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

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

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

        Function process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self, messages: List[Message]) -> List[Message]:
                """Tokenize the incoming messages."""
                for message in messages:
                    for attribute in MESSAGE_ATTRIBUTES:
                        if isinstance(message.get(attribute), str):
        Severity: Minor
        Found in rasa/nlu/tokenizers/tokenizer.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 get_data_files has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_data_files(
            paths: Optional[Union[Text, List[Text]]], filter_predicate: Callable[[Text], bool]
        ) -> List[Text]:
            """Recursively collects all training files from a list of paths.
        
        
        Severity: Minor
        Found in rasa/shared/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 get_validated_path has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_validated_path(
            current: Optional[Union["Path", Text]],
            parameter: Text,
            default: Optional[Union["Path", Text]] = None,
            none_is_valid: bool = False,
        Severity: Minor
        Found in rasa/cli/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 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in rasa/nlu/selectors/response_selector.py - About 1 hr to fix

          Function _get_trackers_for_training has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def _get_trackers_for_training(
                  trackers: List[TrackerWithCachedStates],
              ) -> List[TrackerWithCachedStates]:
                  """Filters out the list of trackers which should not be used for training.
          
          
          Severity: Minor
          Found in rasa/core/policies/unexpected_intent_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 _replace_with_oov_token has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def _replace_with_oov_token(
                  self, tokens: List[Text], attribute: Text
              ) -> List[Text]:
                  """Replace OOV words with OOV token."""
                  if self.OOV_token and self.analyzer == "word":
          Severity: Minor
          Found in rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.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 _create_unique_entity_mappings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def _create_unique_entity_mappings(self, domain: Domain) -> Set[Text]:
                  """Finds mappings of type `from_entity` that uniquely set a slot.
          
                  For example in the following form:
                  some_form:
          Severity: Minor
          Found in rasa/core/actions/forms.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 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Function load has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

                  def __init__(
              Severity: Major
              Found in rasa/utils/endpoints.py - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language