gfw-api/gfw-geostore-api

View on GitHub
app/src/services/geoStoreServiceV2.js

Summary

Maintainability
F
1 wk
Test Coverage
B
80%

Function saveGeostore has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    static async saveGeostore(geojson, data) {

        const geoStore = {
            geojson
        };
Severity: Minor
Found in app/src/services/geoStoreServiceV2.js - About 2 hrs 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 geoStoreServiceV2.js has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const logger = require('logger');
const GeoStore = require('models/geoStore');
const GeoJSONConverter = require('converters/geoJSONConverter');
const md5 = require('md5');
const CartoDB = require('cartodb');
Severity: Minor
Found in app/src/services/geoStoreServiceV2.js - About 2 hrs to fix

    Function saveGeostore has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static async saveGeostore(geojson, data) {
    
            const geoStore = {
                geojson
            };
    Severity: Major
    Found in app/src/services/geoStoreServiceV2.js - About 2 hrs to fix

      Function crossAntimeridian has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static crossAntimeridian(feature, bbox) {
              logger.info('Checking antimeridian');
      
              const geomTypes = ['Point', 'MultiPoint'];
              const bboxTotal = bbox || turf.bbox(feature);
      Severity: Minor
      Found in app/src/services/geoStoreServiceV2.js - About 1 hr to fix

        Function repairGeometry has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static async repairGeometry(geojson) {
        
                if (process.env.NODE_ENV !== 'test' || geojson.length < 2000) {
                    logger.debug('GeoJSON: %s', JSON.stringify(geojson));
                }
        Severity: Minor
        Found in app/src/services/geoStoreServiceV2.js - About 1 hr to fix

          Function repairGeometry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              static async repairGeometry(geojson) {
          
                  if (process.env.NODE_ENV !== 'test' || geojson.length < 2000) {
                      logger.debug('GeoJSON: %s', JSON.stringify(geojson));
                  }
          Severity: Minor
          Found in app/src/services/geoStoreServiceV2.js - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function crossAntimeridian has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              static crossAntimeridian(feature, bbox) {
                  logger.info('Checking antimeridian');
          
                  const geomTypes = ['Point', 'MultiPoint'];
                  const bboxTotal = bbox || turf.bbox(feature);
          Severity: Minor
          Found in app/src/services/geoStoreServiceV2.js - About 25 mins 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

              static crossAntimeridian(feature, bbox) {
                  logger.info('Checking antimeridian');
          
                  const geomTypes = ['Point', 'MultiPoint'];
                  const bboxTotal = bbox || turf.bbox(feature);
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 2 days to fix
          app/src/services/geoStoreService.js on lines 199..246

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

          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

              static getGeometryType(geojson) {
                  logger.debug('Get geometry type');
                  logger.debug('Geometry type: %s', geojson.type);
          
                  if (geojson.type === 'Point' || geojson.type === 'MultiPoint') {
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 5 hrs to fix
          app/src/services/geoStoreService.js on lines 25..39

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

          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

                  if (geomType && geomType === 'FeatureCollection') {
                      logger.info('Preserving FeatureCollection properties.');
                      props = geoStore.geojson.features[0].properties || null;
                  } else if (geomType && geomType === 'Feature') {
                      logger.info('Preserving Feature properties.');
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 4 hrs to fix
          app/src/services/geoStoreService.js on lines 314..323

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

          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 (data && data.provider) {
                      const geoJsonObtained = await GeoStoreServiceV2.obtainGeoJSON(data.provider);
                      geoStore.geojson = geoJsonObtained.geojson;
                      geoStore.areaHa = geoJsonObtained.area_ha;
                      geoStore.provider = {
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 4 hrs to fix
          app/src/services/geoStoreService.js on lines 300..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 130.

          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 getMultipleGeostores(ids) {
                  logger.debug(`[GeoStoreServiceV2 - getGeostoreByInfoProps] Getting geostores with ids: ${ids}`);
                  const hashes = await Promise.all(ids.map(GeoStoreServiceV2.getNewHash));
                  const query = { hash: { $in: hashes } };
                  const geoStores = await GeoStore.find(query);
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 4 hrs to fix
          app/src/services/geoStoreService.js on lines 125..135

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

          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 (data.rows && data.rows.length === 1) {
                      data.rows[0].geojson = JSON.parse(data.rows[0].geojson);
                      logger.debug(data.rows[0].geojson);
                      return data.rows[0];
                  }
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 2 other locations - About 3 hrs to fix
          app/src/services/geoStoreService.js on lines 73..77
          app/src/services/geoStoreService.js on lines 97..101

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

          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 swapBBox(geoStore) {
                  const orgBbox = turf.bbox(geoStore.geojson);
                  const bbox = turf.featureReduce(
                      geoStore.geojson,
                      (previousValue, currentFeature) => GeoStoreServiceV2.crossAntimeridian(currentFeature, previousValue),
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 3 hrs to fix
          app/src/services/geoStoreService.js on lines 268..277

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

          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 obtainGeoJSON(provider) {
                  logger.debug('Obtaining geojson of provider', provider);
                  switch (provider.type) {
          
                      case CARTO_PROVIDER:
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 2 hrs to fix
          app/src/services/geoStoreService.js on lines 155..166

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

          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

              static bboxToPolygon(bbox) {
                  return turf.polygon([[[bbox[2], bbox[3]], [bbox[2], bbox[1]],
                      [bbox[0], bbox[1]], [bbox[0], bbox[3]],
                      [bbox[2], bbox[3]]]]);
              }
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 2 hrs to fix
          app/src/services/geoStoreService.js on lines 185..189

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

          const executeThunk = (client, sql, params) => new Promise(((resolve, reject) => {
              client.execute(sql, params).done((data) => {
                  resolve(data);
              }).error((err) => {
                  reject(err[0]);
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 3 other locations - About 2 hrs to fix
          app/src/services/coverageService.js on lines 35..41
          app/src/services/coverageServiceV2.js on lines 35..41
          app/src/services/geoStoreService.js on lines 15..21

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

          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 (data && data.provider) {
                      const geoJsonObtained = await GeoStoreServiceV2.obtainGeoJSON(data.provider);
                      geoStore.geojson = geoJsonObtained.geojson;
                      geoStore.areaHa = geoJsonObtained.area_ha;
                  }
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 1 hr to fix
          app/src/services/geoStoreService.js on lines 376..380

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

          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

              static translateBBox(bbox) {
                  logger.debug('Converting bbox from [-180,180] to [0,360] for representation');
                  return [bbox[0], bbox[1], 360 - Math.abs(bbox[2]), bbox[3]];
              }
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 1 hr to fix
          app/src/services/geoStoreService.js on lines 254..257

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

          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

                  if (process.env.NODE_ENV !== 'test' || geoStore.geojson.length < 2000) {
                      logger.debug('Result', JSON.stringify(geoStore.geojson));
                  }
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 2 other locations - About 1 hr to fix
          app/src/services/geoStoreServiceV2.js on lines 323..325
          app/src/services/geoStoreServiceV2.js on lines 338..340

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

          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

                  if (process.env.NODE_ENV !== 'test' || geoStore.geojson.length < 2000) {
                      logger.debug('Converting', JSON.stringify(geoStore.geojson));
                  }
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 2 other locations - About 1 hr to fix
          app/src/services/geoStoreServiceV2.js on lines 338..340
          app/src/services/geoStoreServiceV2.js on lines 343..345

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

          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

                  if (process.env.NODE_ENV !== 'test' || geoStore.geojson.length < 2000) {
                      logger.debug('Repaired geometry', JSON.stringify(geoStore.geojson));
                  }
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 2 other locations - About 1 hr to fix
          app/src/services/geoStoreServiceV2.js on lines 323..325
          app/src/services/geoStoreServiceV2.js on lines 343..345

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

          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

              static async getNewHash(hash) {
                  const idCon = await IdConnection.findOne({ oldId: hash }).exec();
                  if (!idCon) {
                      return hash;
                  }
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 1 hr to fix
          app/src/services/geoStoreService.js on lines 105..111

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

          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 calculateBBox(geoStore) {
                  logger.debug('Calculating bbox');
                  geoStore.bbox = GeoStoreServiceV2.swapBBox(geoStore);
                  await geoStore.save();
                  return geoStore;
          Severity: Major
          Found in app/src/services/geoStoreServiceV2.js and 1 other location - About 1 hr to fix
          app/src/services/geoStoreService.js on lines 288..293

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

          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

          There are no issues that match your filters.

          Category
          Status