Showing 6,140 of 6,140 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

class TwitterContainer extends React.Component<FinalProps, State> {
  constructor(props: FinalProps) {
    super(props);

    this.state = { twitterAccountId: '', accountId: '' };
ui/src/modules/settings/integrations/containers/gmail/Form.tsx on lines 23..94

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 498.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export const WEBHOOK_ACTIONS = [
            { label: 'Customer created', action: 'create', type: 'customer' },
            { label: 'Customer updated', action: 'update', type: 'customer' },
            { label: 'Customer deleted', action: 'delete', type: 'customer' },
            { label: 'Company created', action: 'create', type: 'company' },
          Severity: Major
          Found in api/src/db/models/definitions/constants.ts and 1 other location - About 2 days to fix
          ui/src/modules/settings/constants.ts on lines 370..465

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 453.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export const WEBHOOK_ACTIONS = [
            { label: 'Customer created', action: 'create', type: 'customer' },
            { label: 'Customer updated', action: 'update', type: 'customer' },
            { label: 'Customer deleted', action: 'delete', type: 'customer' },
            { label: 'Company created', action: 'create', type: 'company' },
          Severity: Major
          Found in ui/src/modules/settings/constants.ts and 1 other location - About 2 days to fix
          api/src/db/models/definitions/constants.ts on lines 785..840

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 453.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                        Function loadClass has 457 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const loadClass = () => {
                          class User {
                            public static async getUser(_id: string) {
                              const user = await Users.findOne({ _id });
                        
                        
                        Severity: Major
                        Found in api/src/db/models/Users.ts - About 2 days to fix

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          class ProductTypeFilter extends React.Component<IProps> {
                            render() {
                              const { history } = this.props;
                          
                              const onClear = () => {
                          ui/src/modules/settings/productService/components/product/filters/ProdcutTypeFilter.tsx on lines 15..66

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 390.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          class ProductTypeFilter extends React.Component<IProps> {
                            render() {
                              const { history } = this.props;
                          
                              const onClear = () => {
                          ui/src/modules/settings/templates/components/product/filters/ProdcutTypeFilter.tsx on lines 15..66

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 390.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language