Showing 6,140 of 6,140 total issues

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

      if (dashboard && dashboard.order) {
        const childDashboards = await Dashboards.find({
          $and: [
            {
              order: { $regex: new RegExp(escapeRegExp(dashboard.order), 'i') }
Severity: Major
Found in api/src/db/models/Dashboard.ts and 1 other location - About 1 day to fix
api/src/db/models/Tags.ts on lines 274..310

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

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

      if (tag && tag.order) {
        const childTags = await Tags.find({
          $and: [
            { order: { $regex: new RegExp(escapeRegExp(tag.order), 'i') } },
            { _id: { $ne: _id } }
Severity: Major
Found in api/src/db/models/Tags.ts and 1 other location - About 1 day to fix
api/src/db/models/Dashboard.ts on lines 213..251

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

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

export const removeIntegration = async (
  integrationErxesApiId: string,
  removeAll: boolean = false
): Promise<string> => {
  const integration = await Integrations.findOne({
Severity: Major
Found in integrations/src/helpers.ts - About 1 day to fix

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

    const removeRelatedIds = async (dashboard: IDashboardDocument) => {
      const dashboards = await Dashboards.find({
        relatedIds: { $in: dashboard._id }
      });
    
    
    Severity: Major
    Found in api/src/db/models/Dashboard.ts and 1 other location - About 1 day to fix
    api/src/db/models/Tags.ts on lines 48..78

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

    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

    const removeRelatedIds = async (tag: ITagDocument) => {
      const tags = await Tags.find({ relatedIds: { $in: tag._id } });
    
      if (tags.length === 0) {
        return;
    Severity: Major
    Found in api/src/db/models/Tags.ts and 1 other location - About 1 day to fix
    api/src/db/models/Dashboard.ts on lines 60..92

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

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

    import * as _ from 'underscore';
    import {
      Boards,
      Conformities,
      Pipelines,
    Severity: Major
    Found in api/src/data/modules/segments/queryBuilder.ts - About 1 day to fix

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

      import {
        Companies,
        Conversations,
        Customers,
        Deals,
      Severity: Major
      Found in api/src/data/modules/fields/utils.ts - About 1 day to fix

        Function generateQueryBySegment has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
        Open

        export const generateQueryBySegment = async (args: {
          segment: ISegment;
          selector: any;
          options?: IOptions;
          isInitialCall?: boolean;
        Severity: Minor
        Found in api/src/data/modules/segments/queryBuilder.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

          render() {
            const { selectedValues } = this.state;
            const { objects, closeModal, mergeProductLoading } = this.props;
        
            const [product1, product2] = objects;
        ui/src/modules/customers/components/detail/CustomersMerge.tsx on lines 191..226

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

        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

          render() {
            const { selectedValues } = this.state;
            const { objects, closeModal, mergeCustomerLoading } = this.props;
            const [customer1, customer2] = objects;
        
        
        ui/src/modules/settings/productService/components/product/detail/ProductsMerge.tsx on lines 147..183

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

        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 3 locations. Consider refactoring.
        Open

        export const loadBranchClass = () => {
          class Branch {
            /*
             * Get a branch
             */
        Severity: Major
        Found in api/src/db/models/Structure.ts and 2 other locations - About 1 day to fix
        api/src/db/models/Structure.ts on lines 25..84
        api/src/db/models/Structure.ts on lines 183..238

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

        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 3 locations. Consider refactoring.
        Open

        export const loadStructureClass = () => {
          class Structure {
            /*
             * Get a structure
             */
        Severity: Major
        Found in api/src/db/models/Structure.ts and 2 other locations - About 1 day to fix
        api/src/db/models/Structure.ts on lines 183..238
        api/src/db/models/Structure.ts on lines 252..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 285.

        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 3 locations. Consider refactoring.
        Open

        export const loadUnitClass = () => {
          class Unit {
            /*
             * Get an unit
             */
        Severity: Major
        Found in api/src/db/models/Structure.ts and 2 other locations - About 1 day to fix
        api/src/db/models/Structure.ts on lines 25..84
        api/src/db/models/Structure.ts on lines 252..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 285.

        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

        const ticketQueries = {
          /**
           * Tickets list
           */
          async tickets(
        Severity: Major
        Found in api/src/data/resolvers/queries/tickets.ts and 1 other location - About 1 day to fix
        api/src/data/resolvers/queries/tasks.ts on lines 17..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 280.

        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

        const taskQueries = {
          /**
           * Tasks list
           */
          async tasks(
        Severity: Major
        Found in api/src/data/resolvers/queries/tasks.ts and 1 other location - About 1 day to fix
        api/src/data/resolvers/queries/tickets.ts on lines 17..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 280.

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

          render() {
            const { configsMap, language } = this.state;
        
            const breadcrumb = [
              { title: __('Settings'), link: '/settings' },
        Severity: Major
        Found in ui/src/modules/settings/general/components/GeneralSettings.tsx - About 1 day to fix

          File Customers.ts has 672 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Model, model } from 'mongoose';
          import { ACTIVITY_LOG_ACTIONS, putActivityLog } from '../../data/logUtils';
          import { sendToWebhook, validSearchText } from '../../data/utils';
          import { validateSingle } from '../../data/verifierUtils';
          import {
          Severity: Major
          Found in api/src/db/models/Customers.ts - About 1 day to fix

            File AppContext.tsx has 669 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import gql from "graphql-tag";
            import * as React from "react";
            import client from "../../apollo-client";
            import { getLocalStorageItem, setLocalStorageItem } from "../../common";
            import {
            Severity: Major
            Found in widgets/client/messenger/containers/AppContext.tsx - About 1 day to fix

              File boardUtils.ts has 664 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import * as moment from 'moment';
              import {
                Companies,
                Conformities,
                Customers,
              Severity: Major
              Found in api/src/data/resolvers/queries/boardUtils.ts - About 1 day to fix

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

                  test('Get archived growth hacks count', async () => {
                    const pipeline = await pipelineFactory({ type: BOARD_TYPES.GROWTH_HACK });
                    const stage = await stageFactory({ pipelineId: pipeline._id });
                    const args = {
                      stageId: stage._id,
                Severity: Major
                Found in api/src/__tests__/growthHackQueries.test.ts and 2 other locations - About 1 day to fix
                api/src/__tests__/taskQueries.test.ts on lines 287..329
                api/src/__tests__/ticketQueries.test.ts on lines 299..341

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

                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