Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

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

    _defineRequests: function() {
      var cache = this._cacheConfig;
      var config = { cache: cache, url: this._uriTemplate };

      ds.define(this.requestId, config);
Severity: Major
Found in app/assets/javascripts/map/services/RegionService.js and 4 other locations - About 1 hr to fix
app/assets/javascripts/map/services/CountriesService.js on lines 33..38
app/assets/javascripts/map/services/CountryService.js on lines 33..38
app/assets/javascripts/map/services/SitesService.js on lines 33..37
app/assets/javascripts/map/services/TreeLossCarbonEmissionsService.js on lines 36..41

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

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

      _getUrl: function(x, y, z) {
        return new UriTemplate(this.options.urlTemplate).fillFromObject({
          x: x,
          y: y,
          z: z,
app/assets/javascripts/map/views/layers/BiomassLossLayer.js on lines 141..148
app/assets/javascripts/map/views/layers/Forest2000Layer.js on lines 75..82
app/assets/javascripts/map/views/layers/LossLayer.js on lines 97..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 61.

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

      updateLatlngAnalysis: function(lat, lng) {
        var html = 'Lat/long: {0}, {1}'.format(lat.toFixed(6), lng.toFixed(6));
        this.$analysislatlng.html(html);
      },
Severity: Major
Found in app/assets/javascripts/map/views/MapView.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/MapView.js on lines 584..587

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

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

      _hideTooltip: function() {
        this.tooltip.classList.remove('-visible');

        d3.select('.' + this.defaults.chartClass).classed('hovering', false);
      },
app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 969..973

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

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

    render: function() {
      var self = this;

      this.$el.html('');

app/assets/javascripts/countries/views/pantropical/PantropicalTotalEmissionsView.js on lines 11..19

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

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

      _showTooltip: function() {
        this.tooltip.classList.add('-visible');

        d3.select('.' + this.defaults.chartClass).classed('hovering', true);
      },
app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 963..967

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

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

      updateLatlngInfo: function(lat, lng) {
        var html = 'Lat/long: {0}, {1}'.format(lat.toFixed(6), lng.toFixed(6));
        this.$maplngLng.html(html);
      },
Severity: Major
Found in app/assets/javascripts/map/views/MapView.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/MapView.js on lines 569..572

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

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

        _.each(
          this.isoLayers,
          _.bind(function(layer) {
            if (layer.iso === this.iso) {
              layersToRender.push(layer);
Severity: Major
Found in app/assets/javascripts/map/views/tabs/CountriesView.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/LayersNavView.js on lines 377..384

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

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

        _.each(
          this.layersIso,
          _.bind(function(layer) {
            if (layer.iso === this.iso) {
              layersToRender.push(layer);
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/tabs/CountriesView.js on lines 153..160

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

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

      _getDomain: function() {
        var _this = this;
        var xValues = [];
        var x2Values = [];
        var yValues = [];

    Function toogleSelectedWrapper has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          toogleSelectedWrapper: function(layers) {
            // Toggle sublayers
            _.each(this.$el.find('.wrapped-layer'), function(li) {
              var $li = $(li);
              var $toggle = $li.find('.onoffradio, .onoffswitch');
    Severity: Minor
    Found in app/assets/javascripts/map/views/LayersNavView.js - About 1 hr to fix

      Function _subscribeWdpai has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            _subscribeWdpai: function(wdpaid) {
              // Build resource
              var resource = this._buildResource({
                wdpaid: wdpaid,
                type: 'other'
      Severity: Minor
      Found in app/assets/javascripts/map/presenters/tabs/SubscriptionPresenter.js - About 1 hr to fix

        Function _changeYear has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _changeYear: function(ev) {
              var action = ev.currentTarget.dataset.action;
              var $parent = ev.currentTarget.parentNode;
              var $selector = $parent.querySelector('.js-year-selector');
              var options = $selector.options;
        Severity: Minor
        Found in app/assets/javascripts/insights/views/InsightsGladAlertsView.js - About 1 hr to fix

          Function _handlePlaceGo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                _handlePlaceGo: function(params) {
                  // this.deleteAnalysis();
          
                  //Open analysis tab
                  if (
          Severity: Minor
          Found in app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js - About 1 hr to fix

            Function _changeYear has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  _changeYear: function(ev) {
                    var action = ev.currentTarget.dataset.action;
                    var $parent = ev.currentTarget.parentNode;
                    var $selector = $parent.querySelector('.js-year-selector');
                    var options = $selector.options;

              Function onIndicatorsChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    onIndicatorsChange: function(selection) {
                      var dataSourceOptions = [];
                      this.availableIndicators = [];
                      this.widgets.forEach(function(widget) {
                        if (
              Severity: Minor
              Found in app/assets/javascripts/data-download/views/DataDownloadIndexView.js - About 1 hr to fix

                Function _parseData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      _parseData: function() {
                        var tzOffset = new Date().getTimezoneOffset() + 60;
                        this.chartData = [];
                
                        for (var indictator in this.data) {
                Severity: Minor
                Found in app/assets/javascripts/countries/views/report/SummaryChartView.js - About 1 hr to fix

                  Function _createScales has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      LineChart.prototype._createScales = function() {
                        var self = this;
                        this.xKey = this.options.keys.x;
                        this.yKey = this.options.keys.y;
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/widgets/indicators/line/LineChart.js - About 1 hr to fix

                    Method prepare_response has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def prepare_response results
                        return {} if !results || results.empty?
                        response = {}
                        response[:iso] = @iso
                        response[:country] = results.first["country"]
                    Severity: Minor
                    Found in app/models/country_report.rb - About 1 hr to fix

                      Function getClimateConfig has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            getClimateConfig: function(params) {
                              return new Promise(
                                function(resolve, reject) {
                                  var status = _.extend({}, CONFIG, params);
                                  var url = new UriTemplate(APIURLS.getClimateConfig).fillFromObject(
                      Severity: Minor
                      Found in app/assets/javascripts/services/CountryService.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language