RocketChat/Rocket.Chat

View on GitHub

Showing 3,448 of 8,947 total issues

Function MeetPage has 134 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MeetPage = () => {
    const t = useTranslation();
    const [isRoomMember, setIsRoomMember] = useState(false);
    const [status, setStatus] = useState(null);
    const [visitorId, setVisitorId] = useState(null);
Severity: Major
Found in apps/meteor/client/views/meet/MeetPage.tsx - About 5 hrs to fix

    File Utils.ts has 389 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { EventEmitter } from 'events';
    import zlib from 'zlib';
    
    import type { Logger } from '@rocket.chat/logger';
    
    
    Severity: Minor
    Found in apps/meteor/app/meteor-accounts-saml/server/lib/Utils.ts - About 5 hrs to fix

      E2ERoom has 40 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class E2ERoom extends Emitter {
          state = undefined;
      
          [PAUSED] = undefined;
      
      
      Severity: Minor
      Found in apps/meteor/app/e2e/client/rocketchat.e2e.room.js - About 5 hrs to fix

        TeamService has 40 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class TeamService extends ServiceClassInternal implements ITeamService {
            protected name = 'team';
        
            async create(uid: string, { team, room = { name: team.name, extraData: {} }, members, owner }: ITeamCreateParams): Promise<ITeam> {
                if (!(await checkUsernameAvailability(team.name))) {
        Severity: Minor
        Found in apps/meteor/server/services/team/service.ts - About 5 hrs to fix

          Function processFilesForTarget has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

              async processFilesForTarget(files) {
                  const processVersionFile = async function (file) {
                      const data = await new Promise((resolve, reject) => {
                          const currentVersion =
                              JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }))?.version || '';
          Severity: Minor
          Found in apps/meteor/packages/rocketchat-version/plugin/compile-version.js - 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 updateIncomingIntegration has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

              async updateIncomingIntegration(integrationId, integration) {
                  if (!this.userId) {
                      throw new Meteor.Error('error-invalid-user', 'Invalid user', {
                          method: 'updateOutgoingIntegration',
                      });

          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 registerContact has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

              async registerContact({
                  token,
                  name,
                  email = '',
                  phone,
          Severity: Minor
          Found in apps/meteor/app/livechat/server/lib/Contacts.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 deleteUser has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          export async function deleteUser(userId: string, confirmRelinquish = false, deletedBy?: IUser['_id']): Promise<void> {
              if (userId === 'rocket.cat') {
                  throw new Meteor.Error('error-action-not-allowed', 'Deleting the rocket.cat user is not allowed', {
                      method: 'deleteUser',
                      action: 'Delete_user',
          Severity: Minor
          Found in apps/meteor/app/lib/server/functions/deleteUser.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 mapSSOGroupsToChannels has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

              static async mapSSOGroupsToChannels(
                  user: IUser,
                  identity: Record<string, any>,
                  groupClaimName: string,
                  channelsMap: Record<string, any> | undefined,
          Severity: Minor
          Found in apps/meteor/ee/server/lib/oauth/Manager.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

          File index.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Apps, AppEvents } from '@rocket.chat/apps';
          import { User } from '@rocket.chat/core-services';
          import { Roles, Settings, Users } from '@rocket.chat/models';
          import { escapeRegExp, escapeHTML } from '@rocket.chat/string-helpers';
          import { getLoginExpirationInDays } from '@rocket.chat/tools';
          Severity: Minor
          Found in apps/meteor/app/authentication/server/startup/index.js - About 5 hrs to fix

            File LivechatVisitors.ts has 385 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import type { ILivechatVisitor, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
            import type { FindPaginated, ILivechatVisitorsModel } from '@rocket.chat/model-typings';
            import { Settings } from '@rocket.chat/models';
            import { escapeRegExp } from '@rocket.chat/string-helpers';
            import type {
            Severity: Minor
            Found in apps/meteor/server/models/raw/LivechatVisitors.ts - About 5 hrs to fix

              Function SubscriptionPage has 130 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const SubscriptionPage = () => {
                  const showLicense = useShowLicense();
                  const router = useRouter();
                  const { data: enterpriseData } = useIsEnterprise();
                  const { isRegistered } = useRegistrationStatus();
              Severity: Major
              Found in apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx - About 5 hrs to fix

                File cookies.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { Meteor } from 'meteor/meteor';
                
                let fetch;
                let WebApp;
                
                
                Severity: Minor
                Found in apps/meteor/packages/meteor-cookies/cookies.js - About 5 hrs to fix

                  Function ResetPasswordPage has 129 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const ResetPasswordPage = (): ReactElement => {
                      const user = useUser();
                      const t = useTranslation();
                      const setUserPassword = useMethod('setUserPassword');
                      const resetPassword = useMethod('resetPassword');
                  Severity: Major
                  Found in packages/web-ui-registration/src/ResetPassword/ResetPasswordPage.tsx - About 5 hrs to fix

                    File general.ts has 380 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { settingsRegistry } from '../../app/settings/server';
                    
                    export const createGeneralSettings = () =>
                        settingsRegistry.addGroup('General', async function () {
                            await this.section('REST API', async function () {
                    Severity: Minor
                    Found in apps/meteor/server/settings/general.ts - About 5 hrs to fix

                      Function AdminUsersPage has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const AdminUsersPage = (): ReactElement => {
                          const t = useTranslation();
                      
                          const seatsCap = useSeatsCap();
                      
                      
                      Severity: Major
                      Found in apps/meteor/client/views/admin/users/AdminUsersPage.tsx - About 5 hrs to fix

                        File Response.ts has 379 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import xmldom from '@xmldom/xmldom';
                        import xmlCrypto from 'xml-crypto';
                        import xmlenc from 'xml-encryption';
                        
                        import type { ISAMLAssertion } from '../../definition/ISAMLAssertion';
                        Severity: Minor
                        Found in apps/meteor/app/meteor-accounts-saml/server/lib/parsers/Response.ts - About 5 hrs to fix

                          Function codeblocks has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const codeblocks = (message) => {
                              // Count occurencies of ```
                              const count = (message.html.match(/```/gm) || []).length;
                          
                              if (count) {
                          Severity: Minor
                          Found in apps/meteor/app/markdown/lib/parser/original/code.js - 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 loginHandlerCAS has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const loginHandlerCAS = async (options: any): Promise<undefined | Accounts.LoginMethodResult> => {
                              if (!options.cas) {
                                  return undefined;
                              }
                          
                          
                          Severity: Minor
                          Found in apps/meteor/server/lib/cas/loginHandler.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 _initAuth has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected _initAuth(): void {
                                  const loginCompatibility = (bodyParams: Record<string, any>, request: Request): Record<string, any> => {
                                      // Grab the username or email that the user is logging in with
                                      const { user, username, email, password, code: bodyCode } = bodyParams;
                                      let usernameToLDAPLogin = '';
                          Severity: Minor
                          Found in apps/meteor/app/api/server/api.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

                          Severity
                          Category
                          Status
                          Source
                          Language