teamdigitale/digital-citizenship-functions

View on GitHub

Showing 55 of 191 total issues

File messages.ts has 563 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Implements the API handlers for the Message resource.
 */
import * as express from "express";
import * as t from "io-ts";
Severity: Major
Found in lib/controllers/messages.ts - About 1 day to fix

    File created_message_queue_handler.ts has 465 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * This function will process events triggered by newly created messages.
     * For each new input message, the delivery preferences associated to the
     * recipient of the message gets retrieved and a notification gets delivered
     * to each configured channel.
    Severity: Minor
    Found in lib/created_message_queue_handler.ts - About 7 hrs to fix

      Function handleMessage has 151 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function handleMessage(
        lProfileModel: ProfileModel,
        lMessageModel: MessageModel,
        lNotificationModel: NotificationModel,
        lSenderServiceModel: SenderServiceModel,
      Severity: Major
      Found in lib/created_message_queue_handler.ts - About 6 hrs to fix

        Function index has 150 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function index(
          context: ContextWithBindings
        ): Promise<OutputBindings | Error | void> {
          const stopProcessing = undefined;
          const logLevel = isProduction ? "info" : "debug";
        Severity: Major
        Found in lib/emailnotifications_queue_handler.ts - About 6 hrs to fix

          File emailnotifications_queue_handler.ts has 408 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
           * This function will process events triggered by newly created messages.
           * For each new input message, the delivery preferences associated to the
           * recipient of the message gets retrieved and a notification gets delivered
           * to each configured channel.
          Severity: Minor
          Found in lib/emailnotifications_queue_handler.ts - About 5 hrs to fix

            Function CreateMessageHandler has 138 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function CreateMessageHandler(
              getCustomTelemetryClient: CustomTelemetryClientFactory,
              messageModel: MessageModel,
              generateObjectId: ObjectIdGenerator
            ): ICreateMessageHandler {
            Severity: Major
            Found in lib/controllers/messages.ts - About 5 hrs to fix

              File webhook_queue_handler.ts has 386 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               * This function will process events triggered by newly created messages.
               *
               * For each new input message, retrieve the URL associated to the webhook
               * from the payload then send an HTTP request to the API Proxy
              Severity: Minor
              Found in lib/webhook_queue_handler.ts - About 5 hrs to fix

                Function index has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export async function index(
                  context: ContextWithBindings
                ): Promise<OutputBindings | Error | void> {
                  const logLevel = isProduction ? "info" : "debug";
                  configureAzureContextTransport(context, winston, logLevel);
                Severity: Major
                Found in lib/webhook_queue_handler.ts - About 5 hrs to fix

                  Function index has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function index(
                    context: ContextWithBindings
                  ): Promise<OutputBindings | Error | void> {
                    const logLevel = isProduction ? "info" : "debug";
                    configureAzureContextTransport(context, winston, logLevel);
                  Severity: Major
                  Found in lib/created_message_queue_handler.ts - About 4 hrs to fix

                    Function handleNotification has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export async function handleNotification(
                      lMailerTransporter: NodeMailer.Transporter,
                      lAppInsightsClient: TelemetryClient,
                      lNotificationModel: NotificationModel,
                      emailNotificationEvent: NotificationEvent,
                    Severity: Major
                    Found in lib/emailnotifications_queue_handler.ts - About 4 hrs to fix

                      File profiles.ts has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*
                       * Implements the API handlers for the Profile resource.
                       */
                      import * as express from "express";
                      
                      
                      Severity: Minor
                      Found in lib/controllers/profiles.ts - About 4 hrs to fix

                        Function handleNotification has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function handleNotification(
                          lAppInsightsClient: TelemetryClient,
                          lNotificationModel: NotificationModel,
                          webhookNotificationEvent: NotificationEvent
                        ): Promise<Either<RuntimeError, NotificationEvent>> {
                        Severity: Major
                        Found in lib/webhook_queue_handler.ts - About 3 hrs to fix

                          Function GetMessageHandler has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function GetMessageHandler(
                            messageModel: MessageModel,
                            messageStatusModel: MessageStatusModel,
                            notificationModel: NotificationModel,
                            notificationStatusModel: NotificationStatusModel,
                          Severity: Major
                          Found in lib/controllers/messages.ts - About 3 hrs to fix

                            File services.ts has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /*
                             * Implements the API handlers for the Services resource.
                             */
                            import * as express from "express";
                            
                            
                            Severity: Minor
                            Found in lib/controllers/adm/services.ts - About 3 hrs to fix

                              Function UpdateServiceHandler has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function UpdateServiceHandler(
                                serviceModel: ServiceModel
                              ): IUpdateServiceHandler {
                                return async (_, __, ___, serviceId, serviceModelPayload) => {
                                  if (serviceModelPayload.service_id !== serviceId) {
                              Severity: Major
                              Found in lib/controllers/adm/services.ts - About 2 hrs to fix

                                Function index has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export async function index(
                                  context: ContextWithBindings,
                                  event: IProfileCreatedEvent | IProfileUpdatedEvent
                                ): Promise<void> {
                                  const logLevel = isProduction ? "info" : "debug";
                                Severity: Major
                                Found in lib/profile_events_queue_handler.ts - About 2 hrs to fix

                                  Function updateMessageVisibilityTimeout has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function updateMessageVisibilityTimeout(
                                    queueService: QueueService,
                                    queueName: string,
                                    queueMessageBindings: Context["bindings"]
                                  ): Promise<boolean> {
                                  Severity: Minor
                                  Found in lib/utils/azure_queues.ts - About 1 hr to fix

                                    Function UpsertProfileHandler has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function UpsertProfileHandler(
                                      profileModel: ProfileModel
                                    ): IUpsertProfileHandler {
                                      return async (context, _, __, ___, fiscalCode, profileModelPayload) => {
                                        const errorOrMaybeProfile = await profileModel.findOneProfileByFiscalCode(
                                    Severity: Minor
                                    Found in lib/controllers/profiles.ts - About 1 hr to fix

                                      Function handleQueueProcessingFailure has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export async function handleQueueProcessingFailure(
                                        queueService: QueueService,
                                        queueMessageBindings: Context["bindings"],
                                        queueName: string,
                                        onTransientError: (error: RuntimeError) => Promise<Either<RuntimeError, {}>>,
                                      Severity: Minor
                                      Found in lib/utils/azure_queues.ts - About 1 hr to fix

                                        Function getMessageNotificationStatuses has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        async function getMessageNotificationStatuses(
                                          notificationModel: NotificationModel,
                                          notificationStatusModel: NotificationStatusModel,
                                          messageId: NonEmptyString
                                        ): Promise<Either<Error, Option<NotificationStatusHolder>>> {
                                        Severity: Minor
                                        Found in lib/controllers/messages.ts - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language