Showing 2,055 of 6,140 total issues

File conversationQueries.test.ts has 2025 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as moment from 'moment';
import * as sinon from 'sinon';
import { IntegrationsAPI } from '../data/dataSources';
import { graphqlRequest } from '../db/connection';
import {
Severity: Major
Found in api/src/__tests__/conversationQueries.test.ts - About 5 days to fix

    File factories.ts has 1745 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { dateType } from 'aws-sdk/clients/sts'; // tslint:disable-line
    import * as faker from 'faker';
    import * as Random from 'meteor-random';
    import * as momentTz from 'moment-timezone';
    import { FIELDS_GROUPS_CONTENT_TYPES } from '../data/constants';
    Severity: Major
    Found in api/src/db/factories.ts - About 4 days to fix

      Function init has 930 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              init: function (editor) {
                  var rootPath = this.path,
                      defaultConfig = {
                          autoCloseBrackets: true,
                          autoCloseTags: true,
      Severity: Major
      Found in ui/public/ckeditor/plugins/codemirror/plugin.js - About 4 days to fix

        File widgetMutations.test.ts has 1603 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import * as faker from 'faker';
        import * as Random from 'meteor-random';
        import * as sinon from 'sinon';
        import { MESSAGE_KINDS } from '../data/constants';
        import { IntegrationsAPI } from '../data/dataSources';
        Severity: Major
        Found in api/src/__tests__/widgetMutations.test.ts - About 4 days to fix

          File permission.ts has 1459 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          export const moduleObjects = {
            brands: {
              name: 'brands',
              description: 'Brands',
              actions: [
          Severity: Major
          Found in api/src/data/permissions/actions/permission.ts - About 3 days to fix

            File logUtils.ts has 1310 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              putCreateLog as putCreateLogC,
              putDeleteLog as putDeleteLogC,
              putUpdateLog as putUpdateLogC
            } from 'erxes-api-utils';
            Severity: Major
            Found in api/src/data/logUtils.ts - About 3 days to fix

              File nylasController.test.ts has 1102 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import * as sinon from 'sinon';
              import {
                accountFactory,
                integrationFactory,
                nylasCalendarFactory,
              Severity: Major
              Found in integrations/src/__tests__/nylasController.test.ts - About 2 days to fix

                File plugin.js has 1099 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                *  The "codemirror" plugin. It's indented to enhance the
                *  "sourcearea" editing mode, which displays the xhtml source code with
                *  syntax highlight and line numbers.
                * Licensed under the MIT license
                Severity: Major
                Found in ui/public/ckeditor/plugins/codemirror/plugin.js - About 2 days to fix

                  Function loadClass has a Cognitive Complexity of 137 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const loadClass = () => {
                    class Customer {
                      /**
                       * Checking if customer has duplicated unique properties
                       */
                  Severity: Minor
                  Found in api/src/db/models/Customers.ts - About 2 days 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 create has a Cognitive Complexity of 136 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const create = async ({
                    docs,
                    user,
                    contentType,
                    model,
                  Severity: Minor
                  Found in api/src/workers/bulkInsert.worker.ts - About 2 days 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 loadClass has 537 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const loadClass = () => {
                    class Customer {
                      /**
                       * Checking if customer has duplicated unique properties
                       */
                  Severity: Major
                  Found in api/src/db/models/Customers.ts - About 2 days to fix

                    File integrationDb.test.ts has 1059 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import * as faker from 'faker';
                    import * as momentTz from 'moment-timezone';
                    import {
                      brandFactory,
                      conversationFactory,
                    Severity: Major
                    Found in api/src/__tests__/integrationDb.test.ts - About 2 days to fix

                      File engageMessageDb.test.ts has 1023 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import * as faker from 'faker';
                      import * as sinon from 'sinon';
                      import { MESSAGE_KINDS } from '../data/constants';
                      import * as utils from '../data/utils';
                      import {
                      Severity: Major
                      Found in api/src/__tests__/engageMessageDb.test.ts - About 2 days to fix

                        File segments.test.ts has 1017 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import {
                          elkConvertConditionToQuery,
                          fetchSegment,
                          generateNestedQuery,
                          generateQueryBySegment,
                        Severity: Major
                        Found in api/src/__tests__/segments.test.ts - About 2 days to fix

                          Function checkLogicFulfilled has a Cognitive Complexity of 122 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const checkLogicFulfilled = (logics: LogicParams[]) => {
                            const values: { [key: string]: boolean } = {};
                            
                            for (const logic of logics) {
                              const { fieldId, operator, logicValue, fieldValue, validation, type } = logic;
                          Severity: Minor
                          Found in widgets/client/utils.ts - About 2 days 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 global-styles.ts has 971 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { injectGlobal } from 'styled-components';
                          import { robotAnimation } from '../utils/animations';
                          import { colors, typography } from './';
                          
                          const style = `
                          Severity: Major
                          Found in ui/src/modules/common/styles/global-styles.ts - About 2 days to fix

                            File conversationMutations.test.ts has 963 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import * as faker from 'faker';
                            import * as sinon from 'sinon';
                            import { AUTO_BOT_MESSAGES } from '../data/constants';
                            import { IntegrationsAPI } from '../data/dataSources';
                            import utils from '../data/utils';
                            Severity: Major
                            Found in api/src/__tests__/conversationMutations.test.ts - About 2 days to fix

                              File nylas.test.ts has 951 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import * as Nylas from 'nylas';
                              import * as sinon from 'sinon';
                              import {
                                configFactory,
                                integrationFactory,
                              Severity: Major
                              Found in integrations/src/__tests__/nylas.test.ts - About 2 days to fix

                                Function main has 470 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const main = async () => {
                                  const MONGO_URL = getEnv({ name: 'MONGO_URL' });
                                
                                  await shelljs.exec(`mongo "${MONGO_URL}" --eval 'db.killOp()'`, {
                                    silent: true
                                Severity: Major
                                Found in api/src/commands/loadTestData.ts - About 2 days to fix

                                  File loadTestData.ts has 947 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import * as dotenv from 'dotenv';
                                  import * as faker from 'faker';
                                  import * as fs from 'fs';
                                  import { disconnect } from 'mongoose';
                                  import * as shelljs from 'shelljs';
                                  Severity: Major
                                  Found in api/src/commands/loadTestData.ts - About 2 days to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language