resource-watch/graph-client

View on GitHub

Showing 62 of 62 total issues

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

    static async querySimilarDatasets(ctx) {
        logger.info('Obtaining similar datasets', ctx.params.dataset);
        const application = ctx.query.application || ctx.query.app || 'rw';
        const dataset = ctx.params.dataset || ctx.query.dataset || false;
        ctx.assert(dataset, 400, 'dataset query param required');
Severity: Major
Found in app/src/routes/api/v1/graph.router.js and 1 other location - About 2 days to fix
app/src/routes/api/v1/graph.router.js on lines 409..432

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

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

    static async querySimilarDatasetsIncludingDescendent(ctx) {
        logger.info('Obtaining similar datasets with descendent', ctx.params.dataset);
        const application = ctx.query.application || ctx.query.app || 'rw';
        const dataset = ctx.params.dataset || ctx.query.dataset || false;
        ctx.assert(dataset, 400, 'dataset query param required');
Severity: Major
Found in app/src/routes/api/v1/graph.router.js and 1 other location - About 2 days to fix
app/src/routes/api/v1/graph.router.js on lines 384..407

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

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

    static async conceptsAncestors(ctx) {
        let concepts = null;
        const application = ctx.query.application || ctx.query.app || 'rw';
        if (ctx.query.concepts) {
            concepts = ctx.query.concepts.split(',').map((c) => c.trim());
Severity: Major
Found in app/src/routes/api/v1/graph.router.js and 1 other location - About 1 day to fix
app/src/routes/api/v1/graph.router.js on lines 117..142

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

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

    static async conceptsInferred(ctx) {
        let concepts = null;
        const application = ctx.query.application || ctx.query.app || 'rw';
        if (ctx.query.concepts) {
            concepts = ctx.query.concepts.split(',').map((c) => c.trim());
Severity: Major
Found in app/src/routes/api/v1/graph.router.js and 1 other location - About 1 day to fix
app/src/routes/api/v1/graph.router.js on lines 144..169

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

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 graph.router.js has 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable no-underscore-dangle */
const logger = require('logger');
const Router = require('koa-router');
const QueryService = require('services/query.service');
const datasetService = require('services/dataset.service');
Severity: Minor
Found in app/src/routes/api/v1/graph.router.js - About 7 hrs to fix

    File query.service.js has 469 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable no-underscore-dangle */
    const logger = require('logger');
    const Neo4JService = require('services/neo4j.service');
    
    const CREATE_DATASET = `MERGE (dataset:DATASET {id: {id}, views: 0}) RETURN dataset`;
    Severity: Minor
    Found in app/src/services/query.service.js - About 7 hrs to fix

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

          static async createWidgetNodeAndRelation(ctx) {
              logger.info('Creating widget node and relation with idWidget ', ctx.params.idWidget, ' and dataset ', ctx.params.idDataset);
              ctx.set('uncache', `graph-widget widget-graph ${ctx.params.idWidget}-graph`);
              ctx.body = await QueryService.createWidgetNodeAndRelation(ctx.params.idDataset, ctx.params.idWidget);
          }
      Severity: Major
      Found in app/src/routes/api/v1/graph.router.js and 1 other location - About 3 hrs to fix
      app/src/routes/api/v1/graph.router.js on lines 47..51

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

      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

          static async createLayerNodeAndRelation(ctx) {
              logger.info('Creating layer node and relation with idLayer ', ctx.params.idLayer, ' and dataset ', ctx.params.idDataset);
              ctx.set('uncache', `graph-layer layer-graph ${ctx.params.idLayer}-graph`);
              ctx.body = await QueryService.createLayerNodeAndRelation(ctx.params.idDataset, ctx.params.idLayer);
          }
      Severity: Major
      Found in app/src/routes/api/v1/graph.router.js and 1 other location - About 3 hrs to fix
      app/src/routes/api/v1/graph.router.js on lines 41..45

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

      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

      QueryService has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class QueryService {
      
          static async run(query, params) {
              logger.info('Doing query ONLY READ ', query);
              const data = await Neo4JService.query(query, params);
      Severity: Minor
      Found in app/src/services/query.service.js - About 3 hrs to fix

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

                const data = results.records ? results.records.map((el) => {
                    datasetIds.push(el._fields[0]);
                    return {
                        dataset: el._fields[0],
                        views: el._fields[1] ? el._fields[1].low : null
        Severity: Major
        Found in app/src/routes/api/v1/graph.router.js and 1 other location - About 3 hrs to fix
        app/src/routes/api/v1/graph.router.js on lines 330..336

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

        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 simplifiedViewsCount = viewsCount.records ? viewsCount.records.map((el) => {
                    datasetIds.push(el._fields[0]);
                    return {
                        dataset: el._fields[0],
                        views: el._fields[1] ? el._fields[1].low : null
        Severity: Major
        Found in app/src/routes/api/v1/graph.router.js and 1 other location - About 3 hrs to fix
        app/src/routes/api/v1/graph.router.js on lines 363..369

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

        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

        GraphRouter has 27 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class GraphRouter {
        
            static async createDataset(ctx) {
                logger.info('Creating dataset node with id ', ctx.params.id);
                ctx.set('uncache', `graph-dataset dataset-graph ${ctx.params.id}-graph`);
        Severity: Minor
        Found in app/src/routes/api/v1/graph.router.js - About 3 hrs to fix

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

                      if (results.records) {
                          results.records.map((el) => {
                              if (el._fields[0].length > 0) {
                                  datasetIds = datasetIds.concat(el._fields[0]);
                              }
          Severity: Major
          Found in app/src/routes/api/v1/graph.router.js and 2 other locations - About 2 hrs to fix
          app/src/routes/api/v1/graph.router.js on lines 263..270
          app/src/services/query.service.js on lines 531..538

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

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

                  if (results.records) {
                      results.records.map((el) => {
                          if (el._fields[0].length > 0) {
                              datasetIds = datasetIds.concat(el._fields[0]);
                          }
          Severity: Major
          Found in app/src/services/query.service.js and 2 other locations - About 2 hrs to fix
          app/src/routes/api/v1/graph.router.js on lines 263..270
          app/src/routes/api/v1/graph.router.js on lines 301..308

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

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

                  if (results.records) {
                      results.records.map((el) => {
                          if (el._fields[0].length > 0) {
                              datasetIds = datasetIds.concat(el._fields[0]);
                          }
          Severity: Major
          Found in app/src/routes/api/v1/graph.router.js and 2 other locations - About 2 hrs to fix
          app/src/routes/api/v1/graph.router.js on lines 301..308
          app/src/services/query.service.js on lines 531..538

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

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

              static async deleteMetadata(ctx) {
                  logger.info('Deleting metadata node and relation with idWidget ', ctx.params.id);
                  ctx.set('uncache', `graph-metadata metadata-graph ${ctx.params.id}-graph`);
                  ctx.body = await QueryService.deleteMetadata(ctx.params.id);
              }
          Severity: Major
          Found in app/src/routes/api/v1/graph.router.js and 4 other locations - About 2 hrs to fix
          app/src/routes/api/v1/graph.router.js on lines 13..17
          app/src/routes/api/v1/graph.router.js on lines 60..64
          app/src/routes/api/v1/graph.router.js on lines 66..70
          app/src/routes/api/v1/graph.router.js on lines 72..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 87.

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

              static async createDataset(ctx) {
                  logger.info('Creating dataset node with id ', ctx.params.id);
                  ctx.set('uncache', `graph-dataset dataset-graph ${ctx.params.id}-graph`);
                  ctx.body = await QueryService.createDatasetNode(ctx.params.id);
              }
          Severity: Major
          Found in app/src/routes/api/v1/graph.router.js and 4 other locations - About 2 hrs to fix
          app/src/routes/api/v1/graph.router.js on lines 60..64
          app/src/routes/api/v1/graph.router.js on lines 66..70
          app/src/routes/api/v1/graph.router.js on lines 72..76
          app/src/routes/api/v1/graph.router.js on lines 78..82

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

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

              static async deleteWidgetNodeAndRelation(ctx) {
                  logger.info('Deleting widget node and relation with idWidget ', ctx.params.id);
                  ctx.set('uncache', `graph-widget widget-graph ${ctx.params.id}-graph`);
                  ctx.body = await QueryService.deleteWidgetNodeAndRelation(ctx.params.id);
              }
          Severity: Major
          Found in app/src/routes/api/v1/graph.router.js and 4 other locations - About 2 hrs to fix
          app/src/routes/api/v1/graph.router.js on lines 13..17
          app/src/routes/api/v1/graph.router.js on lines 60..64
          app/src/routes/api/v1/graph.router.js on lines 72..76
          app/src/routes/api/v1/graph.router.js on lines 78..82

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

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

              static async deleteDataset(ctx) {
                  logger.info('Deleting dataset node with id ', ctx.params.id);
                  ctx.set('uncache', `graph-dataset dataset-graph ${ctx.params.id}-graph`);
                  ctx.body = await QueryService.deleteDatasetNode(ctx.params.id);
              }
          Severity: Major
          Found in app/src/routes/api/v1/graph.router.js and 4 other locations - About 2 hrs to fix
          app/src/routes/api/v1/graph.router.js on lines 13..17
          app/src/routes/api/v1/graph.router.js on lines 66..70
          app/src/routes/api/v1/graph.router.js on lines 72..76
          app/src/routes/api/v1/graph.router.js on lines 78..82

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

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

              static async deleteLayerNodeAndRelation(ctx) {
                  logger.info('Deleting layer node and relation with idWidget ', ctx.params.id);
                  ctx.set('uncache', `graph-layer layer-graph ${ctx.params.id}-graph`);
                  ctx.body = await QueryService.deleteLayerNodeAndRelation(ctx.params.id);
              }
          Severity: Major
          Found in app/src/routes/api/v1/graph.router.js and 4 other locations - About 2 hrs to fix
          app/src/routes/api/v1/graph.router.js on lines 13..17
          app/src/routes/api/v1/graph.router.js on lines 60..64
          app/src/routes/api/v1/graph.router.js on lines 66..70
          app/src/routes/api/v1/graph.router.js on lines 78..82

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

          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