Showing 543 of 559 total issues

Avoid too many return statements within this function.
Open

        return socketio_webhook
Severity: Major
Found in rasa/core/channels/socketio.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return response.text("success")
    Severity: Major
    Found in rasa/core/channels/telegram.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return telegram_webhook
      Severity: Major
      Found in rasa/core/channels/telegram.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                return response.text("success")
        Severity: Major
        Found in rasa/core/channels/telegram.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return 1 if target else -1
          Severity: Major
          Found in rasa/core/test.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return 0
            Severity: Major
            Found in rasa/core/test.py - About 30 mins to fix

              Function create_report_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def create_report_file() -> None:
                  data = {}
                  for dirpath, dirnames, files in os.walk(os.environ["RESULT_DIR"]):
                      for f in files:
                          if f not in TASK_MAPPING.keys():
              Severity: Minor
              Found in .github/scripts/mr_publish_results.py - About 25 mins 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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def main() -> None:
                  """Run as standalone python application."""
                  parse_last_positional_argument_as_model_path()
                  arg_parser = create_argument_parser()
                  cmdline_arguments = arg_parser.parse_args()
              Severity: Minor
              Found in rasa/__main__.py - About 25 mins 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 send_all_to_datadog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def send_all_to_datadog() -> None:
                  results = []
                  for dirpath, dirnames, files in os.walk(os.environ["RESULT_DIR"]):
                      for f in files:
                          if any(f.endswith(valid_name) for valid_name in TASK_MAPPING.keys()):
              Severity: Minor
              Found in .github/scripts/mr_publish_results.py - About 25 mins 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_local_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_local_model(model_path: Text = DEFAULT_MODELS_PATH) -> Text:
                  """Returns verified path to local model archive.
              
                  Args:
                      model_path: Path to the zipped model. If it's a directory, the latest
              Severity: Minor
              Found in rasa/model.py - About 25 mins 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 apply_mask_and_scaling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def apply_mask_and_scaling(
                      self, loss: tf.Tensor, mask: Optional[tf.Tensor]
                  ) -> tf.Tensor:
                      """Scales the loss and applies the mask if necessary.
              
              
              Severity: Minor
              Found in rasa/utils/tensorflow/layers.py - About 25 mins 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 convert_to_data_format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def convert_to_data_format(
                  features: Union[
                      List[List[Dict[Text, List["Features"]]]], List[Dict[Text, List["Features"]]]
                  ],
                  fake_features: Optional[Dict[Text, List["Features"]]] = None,
              Severity: Minor
              Found in rasa/utils/tensorflow/model_data_utils.py - About 25 mins 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 _rasa_predict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _rasa_predict(
                      self, batch_in: Tuple[np.ndarray, ...]
                  ) -> Dict[Text, Union[np.ndarray, Dict[Text, Any]]]:
                      """Custom prediction method that builds tf graph on the first call.
              
              
              Severity: Minor
              Found in rasa/utils/tensorflow/models.py - About 25 mins 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 _sparse_feature_sizes_have_increased has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _sparse_feature_sizes_have_increased(
                      new_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
                      old_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
                  ) -> bool:
                      """Checks if the sizes of sparse features have increased during fine-tuning.
              Severity: Minor
              Found in rasa/utils/tensorflow/models.py - About 25 mins 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 Grid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                grid-column-gap: ${({ spacious, tiny, noGap }) =>
                  noGap ? 0 : spacious ? '5rem' : tiny ? '.75rem' : '1.875rem'};
              Severity: Minor
              Found in docs/themes/theme-custom/theme/Grid/index.jsx - About 25 mins 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 _features_as_token_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _features_as_token_ids(
                      self, features: List[Union[tf.Tensor, tf.SparseTensor]]
                  ) -> Optional[tf.Tensor]:
                      """Creates dense labels (token IDs) used for negative sampling in MLM."""
                      # If there are dense features, we use them as labels - taking the first dense
              Severity: Minor
              Found in rasa/utils/tensorflow/rasa_layers.py - About 25 mins 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 validate_outdoor_seating has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate_outdoor_seating(
                      self,
                      value: Text,
                      dispatcher: CollectingDispatcher,
                      tracker: Tracker,
              Severity: Minor
              Found in examples/formbot/actions/actions.py - About 25 mins 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 _anonymizer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def _anonymizer(
                  _: structlog.BoundLogger, __: str, event_dict: Dict[str, Any]
              ) -> Dict[str, Any]:
                  """Anonymizes event dict."""
                  anonymizable_keys = [
              Severity: Minor
              Found in rasa/utils/log_utils.py - About 25 mins 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_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _init_from_dict(self, _dict: Dict[Text, Any], parent_directory: Text) -> None:
                      imports = _dict.get("imports") or []
                      imports = [os.path.join(parent_directory, i) for i in imports]
                      # clean out relative paths
                      imports = [os.path.abspath(i) for i in imports]
              Severity: Minor
              Found in rasa/shared/importers/multi_project.py - About 25 mins 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 require_response_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def require_response_keys(
                  responses: List[Dict[Text, Any]], _: Dict, __: Text
              ) -> Union[SchemaError, bool]:
                  """Validates that response dicts have either the "text" key or the "custom" key."""
                  for response in responses:
              Severity: Minor
              Found in rasa/shared/utils/pykwalify_extensions.py - About 25 mins 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