Showing 6,140 of 6,140 total issues

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

import * as faker from 'faker';
import { IntegrationsAPI } from '../data/dataSources';
import { graphqlRequest } from '../db/connection';
import {
  brandFactory,
Severity: Major
Found in api/src/__tests__/integrationMutations.test.ts - About 2 days to fix

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

    export const loadClass = () => {
      class Message {
        /**
         * Get engage message
         */
    Severity: Minor
    Found in api/src/db/models/Engages.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

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

    export const loadTaskClass = () => {
      class Task {
        /**
         * Retreives Task
         */
    Severity: Major
    Found in api/src/db/models/Tasks.ts and 1 other location - About 2 days to fix
    api/src/db/models/Tickets.ts on lines 19..86

    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 375.

    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 loadTicketClass = () => {
      class Ticket {
        /**
         * Retreives Ticket
         */
    Severity: Major
    Found in api/src/db/models/Tickets.ts and 1 other location - About 2 days to fix
    api/src/db/models/Tasks.ts on lines 20..83

    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 375.

    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

      renderMessageContent() {
        const {
          message,
          brands,
          users,
    Severity: Major
    Found in ui/src/modules/engage/components/AutoAndManualForm.tsx and 1 other location - About 2 days to fix
    ui/src/modules/settings/clientPortal/components/ClientPortal.tsx on lines 16..57

    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 374.

    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

    Function loadFieldClass has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
    Open

    export const loadFieldClass = () => {
      class Field {
        static async checkCodeDuplication(code: string) {
          const group = await Fields.findOne({
            code
    Severity: Minor
    Found in api/src/db/models/Fields.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 widgets.ts has 862 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import * as strip from 'strip';
    import {
      Companies,
      Conformities,
      ConversationMessages,
    Severity: Major
    Found in api/src/data/resolvers/mutations/widgets.ts - About 2 days to fix

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

      class TicketColumn extends React.Component<Props, {}> {
        onLoadMore = () => {
          const { tickets, onLoadMore } = this.props;
          onLoadMore(tickets.length);
        };
      Severity: Major
      Found in ui/src/modules/tickets/components/CalendarColumn.tsx and 1 other location - About 2 days to fix
      ui/src/modules/tasks/components/CalendarColumn.tsx on lines 23..67

      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 365.

      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 TaskColumn extends React.Component<Props, {}> {
        onLoadMore = () => {
          const { tasks, onLoadMore } = this.props;
          onLoadMore(tasks.length);
        };
      Severity: Major
      Found in ui/src/modules/tasks/components/CalendarColumn.tsx and 1 other location - About 2 days to fix
      ui/src/modules/tickets/components/CalendarColumn.tsx on lines 23..67

      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 365.

      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 engageMessageMutations.test.ts has 842 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 engageUtils from '../data/resolvers/mutations/engageUtils';
      import { graphqlRequest } from '../db/connection';
      Severity: Major
      Found in api/src/__tests__/engageMessageMutations.test.ts - About 2 days to fix

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

                                window["codemirror_" + editor.id].on("keypress", function (codeMirror_Editor, evt) {
                                    if (config.enableCodeFormatting) {
                                        var range = getSelectedRange();
                                        if (evt.type === "keydown" && evt.ctrlKey && evt.keyCode === 75 && !evt.shiftKey && !evt.altKey) {
                                            window["codemirror_" + editor.id].commentRange(true, range.from, range.to);
        Severity: Major
        Found in ui/public/ckeditor/plugins/codemirror/plugin.js and 1 other location - About 2 days to fix
        ui/public/ckeditor/plugins/codemirror/plugin.js on lines 964..980

        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 358.

        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

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

                        window["codemirror_" + editor.id].on("keypress", function (codeMirror_Editor, evt) {
                            if (config.enableCodeFormatting) {
                                var range = getSelectedRange();
                                if (evt.type === "keydown" && evt.ctrlKey && evt.keyCode === 75 && !evt.shiftKey && !evt.altKey) {
                                    window["codemirror_" + editor.id].commentRange(true, range.from, range.to);
        Severity: Major
        Found in ui/public/ckeditor/plugins/codemirror/plugin.js and 1 other location - About 2 days to fix
        ui/public/ckeditor/plugins/codemirror/plugin.js on lines 228..244

        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 358.

        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

        cube(`Tasks`, {
          sql: `SELECT * FROM ${tableSchema()}__tasks`,
        
          joins: {},
        
        
        Severity: Major
        Found in dashboard-api/schema/Tasks.js and 1 other location - About 2 days to fix
        dashboard-api/schema/Tickets.js on lines 3..65

        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 357.

        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

        cube(`Tickets`, {
          sql: `SELECT * FROM ${tableSchema()}__tickets`,
        
          joins: {},
        
        
        Severity: Major
        Found in dashboard-api/schema/Tickets.js and 1 other location - About 2 days to fix
        dashboard-api/schema/Tasks.js on lines 3..65

        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 357.

        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

        function StatusFilter({ history, counts, emptyText }: IProps) {
          const data = (
            <SidebarList>
              {statusFilters.map((status, index) => {
                const onClick = () => {
        Severity: Major
        Found in ui/src/modules/leads/components/StatusFilter.tsx and 1 other location - About 1 day to fix
        ui/src/modules/automations/components/filters/StatusFilter.tsx on lines 16..63

        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 351.

        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

        function StatusFilter({ history, counts, emptyText }: IProps) {
          const data = (
            <SidebarList>
              {statusFilters.map((status, index) => {
                const onClick = () => {
        ui/src/modules/leads/components/StatusFilter.tsx on lines 16..63

        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 351.

        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 constants.ts has 822 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        export const CONVERSATION_STATUSES = {
          NEW: 'new',
          OPEN: 'open',
          CLOSED: 'closed',
          ENGAGE_VISITOR_AUTO: 'engageVisitorAuto',
        Severity: Major
        Found in api/src/db/models/definitions/constants.ts - About 1 day to fix

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

          import * as moment from 'moment';
          import * as sinon from 'sinon';
          import { graphqlRequest } from '../db/connection';
          import {
            boardFactory,
          Severity: Major
          Found in api/src/__tests__/dealQueries.test.ts - About 1 day to fix

            File AutomationForm.tsx has 816 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { __, Alert } from 'modules/common/utils';
            import { jsPlumb } from 'jsplumb';
            import jquery from 'jquery';
            import RTG from 'react-transition-group';
            import Wrapper from 'modules/layout/components/Wrapper';
            Severity: Major
            Found in ui/src/modules/automations/components/forms/AutomationForm.tsx - About 1 day to fix

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

              const FormContainer = (props: Props) => {
                const { data, loading, error } = useQuery(gql(queries.departments), {
                  fetchPolicy: 'network-only'
                });
              
              
              Severity: Major
              Found in ui/src/modules/settings/team/containers/department/Form.tsx and 1 other location - About 1 day to fix
              ui/src/modules/settings/team/containers/branch/Form.tsx on lines 17..63

              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 344.

              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