RocketChat/Rocket.Chat

View on GitHub

Showing 3,291 of 8,320 total issues

Function Register has 142 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Register: FunctionalComponent<{ path: string }> = () => {
    const { t } = useTranslation();

    const topRef = useRef<HTMLDivElement>(null);
    const bottomRef = useRef<HTMLDivElement>(null);
Severity: Major
Found in packages/livechat/src/routes/Register/index.tsx - About 5 hrs to fix

    Function AccountTokensTable has 142 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const AccountTokensTable = (): ReactElement => {
        const t = useTranslation();
        const dispatchToastMessage = useToastMessageDispatch();
        const setModal = useSetModal();
        const userId = useUserId();

      Function createPushSettings has 141 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          settingsRegistry.addGroup('Push', async function () {
              await this.add('Push_enable', true, {
                  type: 'boolean',
                  public: true,
                  alert: 'Push_Setting_Requires_Restart_Alert',
      Severity: Major
      Found in apps/meteor/server/settings/push.ts - About 5 hrs to fix

        File message.ts has 400 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { MessageTypesValues } from '../../app/lib/lib/MessageTypes';
        import { settingsRegistry } from '../../app/settings/server';
        
        export const createMessageSettings = () =>
            settingsRegistry.addGroup('Message', async function () {
        Severity: Minor
        Found in apps/meteor/server/settings/message.ts - About 5 hrs to fix

          Function getEmojisBySearchTerm has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

          export const getEmojisBySearchTerm = (
              searchTerm: string,
              actualTone: number,
              recentEmojis: string[],
              setRecentEmojis: (emojis: string[]) => void,
          Severity: Minor
          Found in apps/meteor/app/emoji/client/helpers.ts - About 5 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 AppsPageContent has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

          const AppsPageContent = (): ReactElement => {
              const t = useTranslation();
              const { marketplaceApps, installedApps, privateApps, reload } = useAppsResult();
              const [text, setText] = useDebouncedState('', 500);
              const { current, itemsPerPage, setItemsPerPage: onSetItemsPerPage, setCurrent: onSetCurrent, ...paginationProps } = usePagination();
          Severity: Minor
          Found in apps/meteor/client/views/marketplace/AppsPage/AppsPageContent.tsx - About 5 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 RoomMenu has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

          const RoomMenu = ({
              rid,
              unread,
              threadUnread,
              alert,
          Severity: Minor
          Found in apps/meteor/client/sidebar/RoomMenu.tsx - About 5 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

          File MessageBox.tsx has 397 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint-disable complexity */
          import type { IMessage, ISubscription } from '@rocket.chat/core-typings';
          import { useContentBoxSize, useMutableCallback } from '@rocket.chat/fuselage-hooks';
          import {
              MessageComposerAction,
          Severity: Minor
          Found in apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx - About 5 hrs to fix

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

                constructor(options: StoreOptions) {
                    options = {
                        onCopyError: this.onCopyError,
                        onFinishUpload: this.onFinishUpload,
                        onRead: this.onRead,
            Severity: Major
            Found in apps/meteor/server/ufs/ufs-store.ts - About 5 hrs to fix

              File LivechatDepartment.ts has 396 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import type { ILivechatDepartment, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
              import type { ILivechatDepartmentModel } from '@rocket.chat/model-typings';
              import { LivechatDepartmentAgents, LivechatUnitMonitors } from '@rocket.chat/models';
              import { escapeRegExp } from '@rocket.chat/string-helpers';
              import type {
              Severity: Minor
              Found in apps/meteor/server/models/raw/LivechatDepartment.ts - About 5 hrs to fix

                File service.ts has 396 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import type { IOmnichannelVoipService, FindVoipRoomsParams } from '@rocket.chat/core-services';
                import { api, ServiceClassInternal, Voip } from '@rocket.chat/core-services';
                import type {
                    IVoipExtensionBase,
                    IVoipExtensionWithAgentInfo,
                Severity: Minor
                Found in apps/meteor/server/services/omnichannel-voip/service.ts - About 5 hrs to fix

                  File license.ts has 396 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import type {
                      ILicenseTag,
                      LicenseEvents,
                      ILicenseV2,
                      ILicenseV3,
                  Severity: Minor
                  Found in ee/packages/license/src/license.ts - About 5 hrs to fix

                    VideoConfManager has 41 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export const VideoConfManager = new (class VideoConfManager extends Emitter<VideoConfEvents> {
                        private userId: string | undefined;
                    
                        private currentCallHandler: ReturnType<typeof setTimeout> | undefined;
                    
                    
                    Severity: Minor
                    Found in apps/meteor/client/lib/VideoConfManager.ts - About 5 hrs to fix

                      Function LeaveMessage has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const LeaveMessage: FunctionalComponent<{ path: string }> = () => {
                          const {
                              config: {
                                  departments = [],
                                  messages: { offlineMessage, offlineSuccessMessage, offlineUnavailableMessage },
                      Severity: Major
                      Found in packages/livechat/src/routes/LeaveMessage/index.tsx - About 5 hrs to fix

                        Function onChangeRoomMembership has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public async onChangeRoomMembership(roomChangeMembershipInput: FederationRoomChangeMembershipDto): Promise<void> {
                                const {
                                    externalRoomId,
                                    normalizedInviteeId,
                                    normalizedRoomId,

                          Function PruneMessagesWithData has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const PruneMessagesWithData = (): ReactElement => {
                              const t = useTranslation();
                              const room = useRoom();
                              const setModal = useSetModal();
                              const { closeTab: close } = useRoomToolbox();

                            Function saveUserProfile has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                            Open

                            async function saveUserProfile(
                                this: Meteor.MethodThisType,
                                settings: {
                                    email?: string;
                                    username?: string;
                            Severity: Minor
                            Found in apps/meteor/server/methods/saveUserProfile.ts - About 5 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 compareBSONValues has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const compareBSONValues = (a: unknown, b: unknown): number => {
                                if (a === undefined) {
                                    return b === undefined ? 0 : -1;
                                }
                            
                            
                            Severity: Minor
                            Found in apps/meteor/client/lib/minimongo/bson.ts - About 5 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 onEmailReceived has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export async function onEmailReceived(email: ParsedMail, inbox: string, department = ''): Promise<void> {
                                logger.info(`New email conversation received on inbox ${inbox}. Will be assigned to department ${department}`);
                                if (!email.from?.value?.[0]?.address) {
                                    return;
                                }
                            Severity: Major
                            Found in apps/meteor/server/features/EmailInbox/EmailInbox_Incoming.ts - About 5 hrs to fix

                              File ModerationReports.ts has 391 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import type {
                                  IMessage,
                                  IModerationAudit,
                                  IModerationReport,
                                  RocketChatRecordDeleted,
                              Severity: Minor
                              Found in apps/meteor/server/models/raw/ModerationReports.ts - About 5 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language