Showing 6,140 of 6,140 total issues

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

File MailForm.tsx has 800 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import dayjs from 'dayjs';
import Button from 'modules/common/components/Button';
import { SmallLoader } from 'modules/common/components/ButtonMutate';
import FormControl from 'modules/common/components/form/Control';
import { Label } from 'modules/common/components/form/styles';
Severity: Major
Found in ui/src/modules/settings/integrations/components/mail/MailForm.tsx - About 1 day to fix

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

    export const loadClass = () => {
      class Message {
        /**
         * Get engage message
         */
    Severity: Major
    Found in api/src/db/models/Engages.ts - About 1 day to fix

      File bulkInsert.worker.ts has 787 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as mongoose from 'mongoose';
      import {
        Boards,
        Companies,
        Conformities,
      Severity: Major
      Found in api/src/workers/bulkInsert.worker.ts - About 1 day to fix

        File utils.ts has 785 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import * as AWS from 'aws-sdk';
        import utils from 'erxes-api-utils';
        import { IEmailParams as IEmailParamsC } from 'erxes-api-utils/lib/emails';
        import { ISendNotification as ISendNotificationC } from 'erxes-api-utils/lib/requests';
        import * as fileType from 'file-type';
        Severity: Major
        Found in api/src/data/utils.ts - About 1 day to fix

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

            deals: {
              name: 'deals',
              description: 'Deals',
              actions: [
                {
          Severity: Major
          Found in api/src/data/permissions/actions/permission.ts and 1 other location - About 1 day to fix
          api/src/data/permissions/actions/permission.ts on lines 577..699

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

          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

            tasks: {
              name: 'tasks',
              description: 'Tasks',
              actions: [
                {
          Severity: Major
          Found in api/src/data/permissions/actions/permission.ts and 1 other location - About 1 day to fix
          api/src/data/permissions/actions/permission.ts on lines 189..311

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

          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 gatherDescriptions has 361 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const gatherDescriptions = async (
            params: IDescriptionParams
          ): Promise<IDescriptions> => {
            const { action, type, obj, updatedDocument } = params;
          
          
          Severity: Major
          Found in api/src/data/logUtils.ts - About 1 day to fix

            Function solveSubmissions has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
            Open

            export const solveSubmissions = async (args: {
              integrationId: string;
              formId: string;
              submissions: ISubmission[];
              browserInfo: any;
            Severity: Minor
            Found in api/src/data/widgetUtils.ts - About 1 day 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

            class TaskColumnContainer extends React.Component<FinalProps> {
              componentWillReceiveProps(nextProps: FinalProps) {
                const { updatedAt, tasksQuery, tasksTotalCountQuery } = this.props;
            
                if (updatedAt !== nextProps.updatedAt) {
            Severity: Major
            Found in ui/src/modules/tasks/containers/CalendarColumn.tsx and 1 other location - About 1 day to fix
            ui/src/modules/tickets/containers/CalendarColumn.tsx on lines 16..61

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

            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 TicketColumnContainer extends React.Component<FinalProps> {
              componentWillReceiveProps(nextProps: FinalProps) {
                const { updatedAt, ticketsQuery, ticketsTotalCountQuery } = this.props;
            
                if (updatedAt !== nextProps.updatedAt) {
            Severity: Major
            Found in ui/src/modules/tickets/containers/CalendarColumn.tsx and 1 other location - About 1 day to fix
            ui/src/modules/tasks/containers/CalendarColumn.tsx on lines 16..61

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

            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 loadClass has 351 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const loadClass = () => {
              class Integration {
                /**
                 * Retreives integration
                 */
            Severity: Major
            Found in api/src/db/models/Integrations.ts - About 1 day to fix

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

              const init = async app => {
                app.get('/fblogin', loginMiddleware);
              
                app.post('/facebook/create-integration', async (req, res, next) => {
                  debugRequest(debugFacebook, req);
              Severity: Major
              Found in integrations/src/facebook/controller.ts - About 1 day to fix

                File conversations.ts has 743 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import * as strip from 'strip';
                import * as _ from 'underscore';
                import {
                  Configs,
                  Conformities,
                Severity: Major
                Found in api/src/data/resolvers/mutations/conversations.ts - About 1 day to fix

                  Function loadFieldClass has 345 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const loadFieldClass = () => {
                    class Field {
                      static async checkCodeDuplication(code: string) {
                        const group = await Fields.findOne({
                          code
                  Severity: Major
                  Found in api/src/db/models/Fields.ts - About 1 day to fix

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

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

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

                      class EmailListContainer extends React.Component<Props> {
                        changeStatus = (_id: string, status: string) => {
                          const isActive =
                            status === null || status === EMAIL_TEMPLATE_STATUSES.ACTIVE;
                          const message = isActive
                      Severity: Major
                      Found in ui/src/modules/settings/emailTemplates/containers/List.tsx and 1 other location - About 1 day to fix
                      ui/src/modules/settings/responseTemplates/containers/List.tsx on lines 25..60

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

                      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 ResponseListContainer extends React.Component<Props> {
                        changeStatus = (_id: string, status: string) => {
                          const isActive =
                            status === null || status === RESPONSE_TEMPLATE_STATUSES.ACTIVE;
                          const message = isActive
                      ui/src/modules/settings/emailTemplates/containers/List.tsx on lines 41..76

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

                      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 Form.tsx has 721 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { IBoard } from 'modules/boards/types';
                      import Button from 'modules/common/components/Button';
                      import FormControl from 'modules/common/components/form/Control';
                      import CommonForm from 'modules/common/components/form/Form';
                      import FormGroup from 'modules/common/components/form/Group';
                      Severity: Major
                      Found in ui/src/modules/segments/components/form/Form.tsx - About 1 day to fix

                        Function gatherDescriptions has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const gatherDescriptions = async (
                          params: IDescriptionParams
                        ): Promise<IDescriptions> => {
                          const { action, type, obj, updatedDocument } = params;
                        
                        
                        Severity: Minor
                        Found in api/src/data/logUtils.ts - About 1 day 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