teamdigitale/digital-citizenship-functions

View on GitHub

Showing 55 of 191 total issues

Avoid too many return statements within this function.
Open

      return ResponseErrorInternal("Error while updating the existing service");
Severity: Major
Found in lib/controllers/adm/services.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return ResponseErrorValidation(
            "Unable to decode CreatedMessageEvent",
            readableReport(createdMessageEventOrError.value)
          );
    Severity: Major
    Found in lib/controllers/messages.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return ResponseErrorQuery(
              "Error while creating Message",
              errorOrMessage.value
            );
      Severity: Major
      Found in lib/controllers/messages.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return ResponseSuccessJson(returnedMessage);
        Severity: Major
        Found in lib/controllers/messages.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return right<RuntimeError, NotificationEvent>(emailNotificationEvent);
          Severity: Major
          Found in lib/emailnotifications_queue_handler.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return left<RuntimeError, OutputBindings>(
                  TransientError("Cannot update message pending status")
                );
            Severity: Major
            Found in lib/created_message_queue_handler.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return left<RuntimeError, NotificationEvent>(error);
              Severity: Major
              Found in lib/webhook_queue_handler.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return ResponseSuccessJson(
                      retrievedServiceToPublic(maybeUpdatedService.value)
                    );
                Severity: Major
                Found in lib/controllers/adm/services.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return left<RuntimeError, OutputBindings>(
                        TransientError("Cannot store message content")
                      );
                  Severity: Major
                  Found in lib/created_message_queue_handler.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return ResponseErrorInternal(
                            `Error retrieving NotificationStatus: ${
                              errorOrNotificationStatuses.value.name
                            }|${errorOrNotificationStatuses.value.message}`
                          );
                    Severity: Major
                    Found in lib/controllers/messages.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return left<RuntimeError, OutputBindings>(
                            TransientError(
                              `Cannot save sender service id: ${errorOrSenderService.value.body}`
                            )
                          );
                      Severity: Major
                      Found in lib/created_message_queue_handler.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          return right<RuntimeError, OutputBindings>(
                            withoutUndefinedValues(outputBindings)
                          );
                        Severity: Major
                        Found in lib/created_message_queue_handler.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return ResponseErrorQuery(
                                  "Error while updating the existing service",
                                  errorOrMaybeUpdatedService.value
                                );
                          Severity: Major
                          Found in lib/controllers/adm/services.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return ResponseErrorInternal(
                                    `Error retrieving MessageStatus: ${
                                      errorOrMaybeMessageStatus.value.code
                                    }|${errorOrMaybeMessageStatus.value.body}`
                                  );
                            Severity: Major
                            Found in lib/controllers/messages.ts - About 30 mins to fix

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

                              export async function handleNotification(
                                lAppInsightsClient: TelemetryClient,
                                lNotificationModel: NotificationModel,
                                webhookNotificationEvent: NotificationEvent
                              ): Promise<Either<RuntimeError, NotificationEvent>> {
                              Severity: Minor
                              Found in lib/webhook_queue_handler.ts - 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