Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

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

      _subscriptions: [
        {
          'Place/register': function(presenter) {
            this._presenters = _.union(this._presenters, [presenter]);
          }
Severity: Major
Found in app/assets/javascripts/map/services/PlaceService.js and 4 other locations - About 1 hr to fix
app/assets/javascripts/compare/services/PlaceService.js on lines 75..86
app/assets/javascripts/countries/services/PlaceService.js on lines 76..87
app/assets/javascripts/embed/services/PlaceService.js on lines 32..43
app/assets/javascripts/services/PlaceService.js on lines 78..89

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

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

      _subscriptions: [
        {
          'Place/register': function(presenter) {
            this._presenters = _.union(this._presenters, [presenter]);
          }
Severity: Major
Found in app/assets/javascripts/compare/services/PlaceService.js and 4 other locations - About 1 hr to fix
app/assets/javascripts/countries/services/PlaceService.js on lines 76..87
app/assets/javascripts/embed/services/PlaceService.js on lines 32..43
app/assets/javascripts/map/services/PlaceService.js on lines 95..106
app/assets/javascripts/services/PlaceService.js on lines 78..89

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

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

define(
  [
    'abstract/layer/CartoDBLayerClass',
    'text!map/cartocss/plantations_by_species.cartocss'
  ],
app/assets/javascripts/map/views/layers/BraPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/BraPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/ColPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/ColPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/IdnPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/IdnPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/KhmPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/KhmPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/LbrPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/LbrPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/MysPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/MysPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/PerPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/PerPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/PlantationsLayerByType.js on lines 6..28

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

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

define(
  [
    'abstract/layer/CartoDBLayerClass',
    'text!map/cartocss/plantations_by_type.cartocss'
  ],
app/assets/javascripts/map/views/layers/BraPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/BraPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/ColPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/ColPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/IdnPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/IdnPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/KhmPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/LbrPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/LbrPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/MysPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/MysPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/PerPlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/PerPlantationsLayerByType.js on lines 6..28
app/assets/javascripts/map/views/layers/PlantationsLayerBySpecies.js on lines 6..28
app/assets/javascripts/map/views/layers/PlantationsLayerByType.js on lines 6..28

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

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

define(
  ['abstract/layer/CartoDBLayerClass', 'text!map/cartocss/Rus_Hcv.cartocss'],
  function(CartoDBLayerClass, Rus_HcvCartocss) {
    'use strict';

Severity: Major
Found in app/assets/javascripts/map/views/layers/RusHcvLayer.js and 6 other locations - About 1 hr to fix
app/assets/javascripts/map/views/layers/BraMiningLayer.js on lines 6..28
app/assets/javascripts/map/views/layers/DamHotspotsLayer.js on lines 6..28
app/assets/javascripts/map/views/layers/MangroveBiomassLayer.js on lines 6..27
app/assets/javascripts/map/views/layers/MysPALayer.js on lines 6..25
app/assets/javascripts/map/views/layers/PeatLandsDrainageLayer.js on lines 6..28
app/assets/javascripts/map/views/layers/PerMiningLayer.js on lines 6..28

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

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

define(
  ['abstract/layer/CartoDBLayerClass', 'text!map/cartocss/mysPA.cartocss'],
  function(CartoDBLayerClass, MysPACartocss) {
    'use strict';

Severity: Major
Found in app/assets/javascripts/map/views/layers/MysPALayer.js and 6 other locations - About 1 hr to fix
app/assets/javascripts/map/views/layers/BraMiningLayer.js on lines 6..28
app/assets/javascripts/map/views/layers/DamHotspotsLayer.js on lines 6..28
app/assets/javascripts/map/views/layers/MangroveBiomassLayer.js on lines 6..27
app/assets/javascripts/map/views/layers/PeatLandsDrainageLayer.js on lines 6..28
app/assets/javascripts/map/views/layers/PerMiningLayer.js on lines 6..28
app/assets/javascripts/map/views/layers/RusHcvLayer.js on lines 6..24

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

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

          _.bind(function(li) {
            if ($(li).hasClass('selected')) {
              var layerSlug = $(li).data('layer');
              this.presenter.toggleLayer(layerSlug);
            }
Severity: Major
Found in app/assets/javascripts/map/views/LayersNavView.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/LayersNavView.js on lines 217..222

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

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

    changeStartDate: function(start_date) {
      var tabs = _.clone(this.status.get('tabs'));
      tabs.start_date = ~~start_date;
      this.status.set('tabs', tabs);
    },
Severity: Major
Found in app/assets/javascripts/widgets/presenters/TabPresenter.js and 1 other location - About 1 hr to fix
app/assets/javascripts/widgets/presenters/TabPresenter.js on lines 55..59

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

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

              _.bind(function(layer) {
                if ($(layer).hasClass('selected')) {
                  var layerSlug = $(layer).data('layer');
                  this.presenter.toggleLayer(layerSlug);
                }
Severity: Major
Found in app/assets/javascripts/map/views/LayersNavView.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/LayersNavView.js on lines 366..371

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

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

define(
  [
    'abstract/layer/CartoDBLayerClass',
    'text!map/cartocss/khm_EcoLand.cartocss'
  ],
Severity: Major
Found in app/assets/javascripts/map/views/layers/KhmEcoLandLayer.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/layers/BraBiomesLayer.js on lines 6..24

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

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

      getPlaceParams: function() {
        var p = {};
        p.iso = this.status.get('iso');
        p.dont_analyze = this.status.get('dont_analyze');
        return p;
app/assets/javascripts/compare/presenters/CompareModalPresenter.js on lines 84..89

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

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

define(
  ['abstract/layer/CartoDBLayerClass', 'text!map/cartocss/bra_biomes.cartocss'],
  function(CartoDBLayerClass, BraBiomesCartoCSS) {
    'use strict';

Severity: Major
Found in app/assets/javascripts/map/views/layers/BraBiomesLayer.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/layers/KhmEcoLandLayer.js on lines 6..28

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

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

      getPlaceParams: function() {
        var p = {};
        p.compare1 = this.status.get('compare1');
        p.compare2 = this.status.get('compare2');
        return p;
app/assets/javascripts/map/presenters/tabs/CountriesPresenter.js on lines 102..107

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

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

    changeEndDate: function(end_date) {
      var tabs = _.clone(this.status.get('tabs'));
      tabs.end_date = ~~end_date;
      this.status.set('tabs', tabs);
    },
Severity: Major
Found in app/assets/javascripts/widgets/presenters/TabPresenter.js and 1 other location - About 1 hr to fix
app/assets/javascripts/widgets/presenters/TabPresenter.js on lines 49..53

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

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

      parseData: function() {
        var forestAndCarbon = 'Forest and Carbon Data';
        // TODO: make this dynamic
        var peatDrainageSlug = 'emissions-from-peat-drainage-on-plantations';
        var peatDrainageCountries = ['IDN', 'MYS'];

    Function _drawYears has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          _drawYears: function() {
            var yearGroup = this.svg.select('.year');
            var yearLabel = _.findWhere(this.defaults.labels, { slug: 'year' });
            var yearLabelWidth = yearLabel.width * this.cWidthGrid / 100;
            var yearsContent = this.svg

      Method get_province_vals_for has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_province_vals_for(data, indicator)
      
          values = data.select do |t|
            t["boundary_code"] == @use_boundary &&
              t["indicator_id"] == indicator &&
      Severity: Minor
      Found in app/models/country_report.rb - About 1 hr to fix

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

                  if (layer) {
                    // var isBaselayer = (layer.category_slug === 'forest_clearing');
        
                    $li.addClass('selected');
                    $toggle.addClass('checked');
        Severity: Major
        Found in app/assets/javascripts/map/views/LayersNavView.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/map/views/LayersNavView.js on lines 251..265

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

        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 (selected > 0) {
                    var color = $li.data('color') || '#cf7fec';
                    $li.addClass('selected');
                    $toggle.addClass('checked');
                    $layerTitle.css('color', color);
        Severity: Major
        Found in app/assets/javascripts/map/views/LayersNavView.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/map/views/LayersNavView.js on lines 106..123

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

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

              _getUrl: function() {
                var template = null;
                var sql = null;
        
                if (!this.url) {
        Severity: Minor
        Found in app/assets/javascripts/map/services/MapLayerService.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language