RocketChat/Rocket.Chat

View on GitHub

Showing 3,268 of 8,229 total issues

Function _retrySubscription has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

Autoupdate._retrySubscription = () => {
    Meteor.subscribe("meteor_autoupdate_clientVersions", {
        onError(error) {
            Meteor._debug("autoupdate subscription failed", error);
            failures++;
Severity: Minor
Found in apps/meteor/packages/autoupdate/autoupdate_client.js - About 1 day 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

File rooms.ts has 538 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Media } from '@rocket.chat/core-services';
import type { IRoom } from '@rocket.chat/core-typings';
import { Messages, Rooms, Users } from '@rocket.chat/models';
import type { Notifications } from '@rocket.chat/rest-typings';
import { isGETRoomsNameExists } from '@rocket.chat/rest-typings';
Severity: Major
Found in apps/meteor/app/api/server/v1/rooms.ts - About 1 day to fix

    Function addSettings has 222 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function addSettings(): Promise<void> {
        return settingsRegistry.addGroup('LDAP', async function () {
            const enableQuery = { _id: 'LDAP_Enable', value: true };
    
            await this.with(
    Severity: Major
    Found in apps/meteor/ee/server/settings/ldap.ts - About 1 day to fix

      File voip.ts has 536 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import type {
          IQueueSummary,
          ILivechatAgent,
          IVoipRoom,
          IUser,
      Severity: Major
      Found in packages/rest-typings/src/v1/voip.ts - About 1 day to fix

        File email.ts has 531 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { settingsRegistry } from '../../app/settings/server';
        
        export const createEmailSettings = () =>
            settingsRegistry.addGroup('Email', async function () {
                await this.section('Style', async function () {
        Severity: Major
        Found in apps/meteor/server/settings/email.ts - About 1 day to fix

          File Manager.ts has 520 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Team } from '@rocket.chat/core-services';
          import type { ILDAPEntry, IUser, IRoom, IRole, IImportUser, IImportRecord } from '@rocket.chat/core-typings';
          import { Users, Roles, Subscriptions as SubscriptionsRaw, Rooms } from '@rocket.chat/models';
          import type ldapjs from 'ldapjs';
          
          
          Severity: Major
          Found in apps/meteor/ee/server/lib/ldap/Manager.ts - About 1 day to fix

            Function createLayoutSettings has 210 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                settingsRegistry.addGroup('Layout', async function () {
                    await this.section('Login', async function () {
                        await this.add('Layout_Login_Hide_Logo', false, {
                            type: 'boolean',
                            public: true,
            Severity: Major
            Found in apps/meteor/server/settings/layout.ts - About 1 day to fix

              File rooms.ts has 516 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import type { IMessage, IRoom, IUser, RoomAdminFieldsType } from '@rocket.chat/core-typings';
              import Ajv from 'ajv';
              
              import type { PaginatedRequest } from '../helpers/PaginatedRequest';
              import type { PaginatedResult } from '../helpers/PaginatedResult';
              Severity: Major
              Found in packages/rest-typings/src/v1/rooms.ts - About 1 day to fix

                Function useAnalyticsEventTracking has 209 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const useAnalyticsEventTracking = () => {
                    const router = useRouter();
                
                    useEffect(
                        () =>
                Severity: Major
                Found in apps/meteor/client/hooks/useAnalyticsEventTracking.ts - About 1 day to fix

                  File OutgoingWebhookForm.tsx has 515 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import type { IOutgoingIntegration } from '@rocket.chat/core-typings';
                  import type { SelectOption } from '@rocket.chat/fuselage';
                  import {
                      FieldError,
                      AccordionItem,

                    File codes.js has 514 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /**
                     * This file is part of https://github.com/martynsmith/node-irc
                     * by https://github.com/martynsmith
                     */
                    
                    
                    Severity: Major
                    Found in apps/meteor/app/irc/server/servers/RFC2813/codes.js - About 1 day to fix

                      Function getTriggersToExecute has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                      Open

                          getTriggersToExecute(room, message) {
                              const triggersToExecute = new Set();
                              if (room) {
                                  switch (room.t) {
                                      case 'd':
                      Severity: Minor
                      Found in apps/meteor/app/integrations/server/lib/triggerHandler.js - About 1 day 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 AppMenu has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function AppMenu({ app, isAppDetailsPage, ...props }) {
                          const t = useTranslation();
                          const dispatchToastMessage = useToastMessageDispatch();
                          const setModal = useSetModal();
                          const router = useRouter();
                      Severity: Minor
                      Found in apps/meteor/client/views/marketplace/AppMenu.js - About 1 day 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 has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public validate(xml: string, callback: IResponseValidateCallback): void {
                              // We currently use RelayState to save SAML provider
                              SAMLUtils.log(`Validating response with relay state: ${xml}`);
                      
                              let error: Error | null = null;
                      Severity: Minor
                      Found in apps/meteor/app/meteor-accounts-saml/server/lib/parsers/Response.ts - About 1 day 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

                      File statistics.ts has 503 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { log } from 'console';
                      import os from 'os';
                      
                      import { Analytics, Team, VideoConf, Presence } from '@rocket.chat/core-services';
                      import type { IRoom, IStats } from '@rocket.chat/core-typings';
                      Severity: Major
                      Found in apps/meteor/app/statistics/server/lib/statistics.ts - About 1 day to fix

                        Function PreferencesMessagesSection has 198 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const PreferencesMessagesSection = () => {
                            const t = useTranslation();
                            const { control } = useFormContext();
                        
                            const alsoSendThreadMessageToChannelOptions = useMemo(

                          Function AccessibilityPage has 194 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const AccessibilityPage = () => {
                              const t = useTranslation();
                              const dispatchToastMessage = useToastMessageDispatch();
                              const preferencesValues = useAccessiblityPreferencesValues();
                          
                          
                          Severity: Major
                          Found in apps/meteor/client/views/account/accessibility/AccessibilityPage.tsx - About 7 hrs to fix

                            Function PreferencesNotificationsSection has 194 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const PreferencesNotificationsSection = () => {
                                const t = useTranslation();
                            
                                const [notificationsPermission, setNotificationsPermission] = useState<NotificationPermission>();
                            
                            

                              Function generateEml has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const generateEml = async (): Promise<void> => {
                                  setImmediate(async () => {
                                      const smarshMissingEmail = settings.get('Smarsh_MissingEmail_Email');
                                      const timeZone = settings.get<string>('Smarsh_Timezone');
                              
                              
                              Severity: Minor
                              Found in apps/meteor/app/smarsh-connector/server/functions/generateEml.ts - About 7 hrs 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 prepareUsingLocalFile has 192 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  async prepareUsingLocalFile(fullFilePath: string): Promise<ImporterProgress> {
                                      this.logger.debug('start preparing import operation');
                                      await this.converter.clearImportData();
                              
                                      const zip = new this.AdmZip(fullFilePath);
                              Severity: Major
                              Found in apps/meteor/app/importer-csv/server/CsvImporter.ts - About 7 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language