Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

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

    _changeVisualizations: function(ev) {
      var current = ev.currentTarget;
      var filter = current.dataset.filter;

      this._changeMainVis(filter);
Severity: Minor
Found in app/assets/javascripts/insights/views/InsightsGladAlertsView.js and 1 other location - About 40 mins to fix
app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsView.js on lines 370..375

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

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

      cache: function() {
        this.graphicEl = this.$('.scroll__graphic');
        this.mouseScroll = this.$('#mouse-scroll-wrapper');
      },
app/assets/javascripts/insights/views/emissions-calculator/EmissionCalculatorIndexView.js on lines 46..49

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

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

    var APIURLS = {
      getClimateConfig: '/query?sql=SELECT iso FROM {countriesConfigDataset}',
      getCountriesList:
        '/query?sql=SELECT name_engli as name, iso FROM {countriesDataset} WHERE iso IN({climateCountries}) ORDER BY name ASC',
      getCountriesListGeo:
Severity: Minor
Found in app/assets/javascripts/services/CountryService.js and 1 other location - About 40 mins to fix
app/assets/javascripts/map/views/maptypes/basemapStyles.js on lines 7..16

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

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 ((index === 0 && firstParam) || query === '') {
              firstParam = false;
              query += '?';
            } else {
              query += '&';
app/assets/javascripts/data-download/views/DataDownloadIndexView.js on lines 475..480

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

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

        var countries = _.map(countryData, function(c) {
          c.href = '/countries/' + c.iso + '/report';
          return c;
        });
app/assets/javascripts/insights/views/emissions-calculator/EmissionCalculatorIndexView.js on lines 101..104

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

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

  var styles = {
    dark: '#242426',
    grayscale: '#BCE1FF',
    terrain: '#BCE1FF',
    satellite: '#2B3872',
Severity: Minor
Found in app/assets/javascripts/map/views/maptypes/basemapStyles.js and 1 other location - About 40 mins to fix
app/assets/javascripts/services/CountryService.js on lines 23..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 48.

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

            } else if (value[0] === value[1]) {
              this.yearsSlider.noUiSlider.set([
                value[0],
                parseInt(value[0], 10) + 1,
                value[2]
app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 109..121

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

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 ((index === 0 && firstParam) || query === '') {
              firstParam = false;
              query += '?';
            } else {
              query += '&';
app/assets/javascripts/data-download/views/DataDownloadIndexView.js on lines 488..493

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

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 decoder has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

          decoder: function(data, status, xhr, success, error) {
Severity: Minor
Found in app/assets/javascripts/services/ContinentService.js - About 35 mins to fix

    Method show_query has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def show_query(indicator_id, iso, id_1, area, thresh_value)
    Severity: Minor
    Found in app/models/indicator.rb - About 35 mins to fix

      Method item_caching has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def item_caching(object, child=nil, format=nil, thresh_value=nil, umd=nil)
      Severity: Minor
      Found in app/models/concerns/cached.rb - About 35 mins to fix

        Function decoder has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                    decoder: function(data, status, xhr, success, error) {
        Severity: Minor
        Found in app/assets/javascripts/countries/services/ReportService.js - About 35 mins to fix

          Function decoder has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                    decoder: function(data, status, xhr, success, error) {
          Severity: Minor
          Found in app/assets/javascripts/services/CountryService.js - About 35 mins to fix

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

            define(['abstract/layer/CartoDBLayerClass'], function(CartoDBLayerClass) {
              'use strict';
            
              var ProdesCoverLayer = CartoDBLayerClass.extend({
                options: {
            Severity: Major
            Found in app/assets/javascripts/map/views/layers/ProdesCoverLayer.js and 14 other locations - About 35 mins to fix
            app/assets/javascripts/map/views/layers/CustomDarkBaseLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/CustomDarkOnlyLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/FormaCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ImazonCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer2000.js on lines 6..17
            app/assets/javascripts/map/views/layers/MangroveLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ModisCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/PantropicalLayer.js on lines 6..19
            app/assets/javascripts/map/views/layers/TotalCarbonLayer.js on lines 7..20
            app/assets/javascripts/map/views/layers/UptakeTotal2028Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2038Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2048Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotalSGCarbonGainLayer.js on lines 7..20

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

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

            define(['abstract/layer/CartoDBLayerClass'], function(CartoDBLayerClass) {
              'use strict';
            
              var MangroveLayer = CartoDBLayerClass.extend({
                options: {
            Severity: Major
            Found in app/assets/javascripts/map/views/layers/MangroveLayer.js and 14 other locations - About 35 mins to fix
            app/assets/javascripts/map/views/layers/CustomDarkBaseLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/CustomDarkOnlyLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/FormaCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ImazonCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer2000.js on lines 6..17
            app/assets/javascripts/map/views/layers/ModisCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/PantropicalLayer.js on lines 6..19
            app/assets/javascripts/map/views/layers/ProdesCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/TotalCarbonLayer.js on lines 7..20
            app/assets/javascripts/map/views/layers/UptakeTotal2028Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2038Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2048Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotalSGCarbonGainLayer.js on lines 7..20

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

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

            define(['abstract/layer/CartoDBLayerClass'], function(CartoDBLayerClass) {
              'use strict';
            
              var FormaCoverLayer = CartoDBLayerClass.extend({
                options: {
            Severity: Major
            Found in app/assets/javascripts/map/views/layers/FormaCoverLayer.js and 14 other locations - About 35 mins to fix
            app/assets/javascripts/map/views/layers/CustomDarkBaseLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/CustomDarkOnlyLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ImazonCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer2000.js on lines 6..17
            app/assets/javascripts/map/views/layers/MangroveLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ModisCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/PantropicalLayer.js on lines 6..19
            app/assets/javascripts/map/views/layers/ProdesCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/TotalCarbonLayer.js on lines 7..20
            app/assets/javascripts/map/views/layers/UptakeTotal2028Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2038Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2048Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotalSGCarbonGainLayer.js on lines 7..20

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

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

            define(['abstract/layer/ImageMaptypeLayerClass'], function(
              ImageMaptypeLayerClass
            ) {
              'use strict';
            
            
            Severity: Major
            Found in app/assets/javascripts/map/views/layers/TotalCarbonLayer.js and 14 other locations - About 35 mins to fix
            app/assets/javascripts/map/views/layers/CustomDarkBaseLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/CustomDarkOnlyLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/FormaCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ImazonCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer2000.js on lines 6..17
            app/assets/javascripts/map/views/layers/MangroveLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ModisCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/PantropicalLayer.js on lines 6..19
            app/assets/javascripts/map/views/layers/ProdesCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/UptakeTotal2028Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2038Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2048Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotalSGCarbonGainLayer.js on lines 7..20

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

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

            define(['abstract/layer/ImageLayerClass'], function(ImageLayerClass) {
              'use strict';
            
              var CustomDarkOnlyLabelsLayer = ImageLayerClass.extend({
                options: {
            app/assets/javascripts/map/views/layers/CustomDarkBaseLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/FormaCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ImazonCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer2000.js on lines 6..17
            app/assets/javascripts/map/views/layers/MangroveLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ModisCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/PantropicalLayer.js on lines 6..19
            app/assets/javascripts/map/views/layers/ProdesCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/TotalCarbonLayer.js on lines 7..20
            app/assets/javascripts/map/views/layers/UptakeTotal2028Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2038Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2048Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotalSGCarbonGainLayer.js on lines 7..20

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

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

            define(['abstract/layer/CartoDBLayerClass'], function(CartoDBLayerClass) {
              'use strict';
            
              var IntactForestLayer = CartoDBLayerClass.extend({
                options: {
            Severity: Major
            Found in app/assets/javascripts/map/views/layers/IntactForestLayer.js and 14 other locations - About 35 mins to fix
            app/assets/javascripts/map/views/layers/CustomDarkBaseLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/CustomDarkOnlyLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/FormaCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ImazonCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer2000.js on lines 6..17
            app/assets/javascripts/map/views/layers/MangroveLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ModisCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/PantropicalLayer.js on lines 6..19
            app/assets/javascripts/map/views/layers/ProdesCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/TotalCarbonLayer.js on lines 7..20
            app/assets/javascripts/map/views/layers/UptakeTotal2028Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2038Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2048Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotalSGCarbonGainLayer.js on lines 7..20

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

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

            define(['abstract/layer/ImageMaptypeLayerClass'], function(
              ImageMaptypeLayerClass
            ) {
              'use strict';
            
            
            app/assets/javascripts/map/views/layers/CustomDarkBaseLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/CustomDarkOnlyLabelsLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/FormaCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ImazonCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/IntactForestLayer2000.js on lines 6..17
            app/assets/javascripts/map/views/layers/MangroveLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/ModisCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/PantropicalLayer.js on lines 6..19
            app/assets/javascripts/map/views/layers/ProdesCoverLayer.js on lines 6..17
            app/assets/javascripts/map/views/layers/TotalCarbonLayer.js on lines 7..20
            app/assets/javascripts/map/views/layers/UptakeTotal2028Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotal2048Layer.js on lines 6..19
            app/assets/javascripts/map/views/layers/UptakeTotalSGCarbonGainLayer.js on lines 7..20

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

            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