Showing 543 of 559 total issues

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

    def _remove_duplicate_trackers(
        self, trackers: List[TrackerWithCachedStates]
    ) -> TrackersTuple:
        """Removes trackers that create equal featurizations
            for current story step.
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_from_directory has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _init_from_directory(self, path: Text) -> None:
        for parent, _, files in os.walk(path, followlinks=True):
            for file in files:
                full_path = os.path.join(parent, file)
                if not self.is_imported(full_path):
Severity: Minor
Found in rasa/shared/importers/multi_project.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 interpolate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def interpolate(
    response: Union[List[Any], Dict[Text, Any], Text], values: Dict[Text, Text]
) -> Union[List[Any], Dict[Text, Any], Text]:
    """Recursively process response and interpolate any text keys.

Severity: Minor
Found in rasa/core/nlg/interpolator.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 _print_bot_output has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _print_bot_output(
    message: Dict[Text, Any],
    is_latest_message: bool = False,
    color: Text = rasa.shared.utils.io.bcolors.OKBLUE,
) -> Optional[questionary.Question]:
Severity: Minor
Found in rasa/core/channels/console.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 ensure_consistent_bilou_tagging has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def ensure_consistent_bilou_tagging(
    predicted_tags: List[Text], predicted_confidences: List[float]
) -> Tuple[List[Text], List[float]]:
    """Ensure predicted tags follow the BILOU tagging schema.

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 list_routes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def list_routes(app: Sanic) -> Dict[Text, Text]:
    """List all the routes of a sanic application. Mainly used for debugging."""
    from urllib.parse import unquote

    output = {}
Severity: Minor
Found in rasa/core/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 _find_events_after_actions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _find_events_after_actions(
    trackers: List["DialogueStateTracker"],
) -> DefaultDict[Text, Set["Event"]]:
    """Creates a mapping of action names / texts and events that follow these actions.

Severity: Minor
Found in rasa/core/training/training.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 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    Function train has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def train(
    Severity: Major
    Found in rasa/model_training.py - About 1 hr to fix

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

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

        Function train has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def train(
        Severity: Major
        Found in rasa/api.py - About 1 hr to fix

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

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

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

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

              Function __init__ has 12 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 12 arguments (exceeds 4 allowed). Consider refactoring.
                Open

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

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

                  def _surface_attributes(
                      features: List[List[Dict[Text, List["Features"]]]],
                      featurizers: Optional[List[Text]] = None,
                  ) -> DefaultDict[Text, List[List[Optional[List["Features"]]]]]:
                      """Restructure the input.
                  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 _does_model_improve has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _does_model_improve(self, curr_results: Dict[Text, Any]) -> bool:
                          """Checks whether the current results are better than the best so far.
                  
                          Results are considered better if each metric is equal or better than the best so
                          far, and at least one is better.
                  Severity: Minor
                  Found in rasa/utils/tensorflow/callback.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 adjust_sparse_layers_for_incremental_training has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def adjust_sparse_layers_for_incremental_training(
                          self,
                          new_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
                          old_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
                          reg_lambda: float,
                  Severity: Minor
                  Found in rasa/utils/tensorflow/rasa_layers.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 read_from_json has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def read_from_json(self, js: Dict[Text, Any], **kwargs: Any) -> TrainingData:
                          """Loads training data stored in the WIT.ai data format."""
                          training_examples = []
                  
                          for s in js["utterances"]:
                  Severity: Minor
                  Found in rasa/shared/nlu/training_data/formats/wit.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 as_dict has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def as_dict(self, only_output_properties: bool = False) -> Dict:
                          """Gets dict representation of message."""
                          if only_output_properties:
                              d = {}
                              for key, value in self.data.items():
                  Severity: Minor
                  Found in rasa/shared/nlu/training_data/message.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