Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

Method data_to_headers_and_rows has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def data_to_headers_and_rows(data)
    rows = []
    if @pivot
      core_headers = data.first.keys.reject{ |k| ['year', 'value'].include? k }
      years = Set.new
Severity: Minor
Found in app/models/data_portal_download.rb - About 1 hr to fix

    Function updatePosition has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function updatePosition(event) {
        var ttid = '#' + tooltipId;
        var xOffset = -120;
        var yOffset = -70;
    
    
    Severity: Minor
    Found in app/assets/javascripts/countries/views/pantropical/vis.js - About 1 hr to fix

      Function _getDomain has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            _getDomain: function() {
              var maxValues = [];
              maxValues.push({
                value: d3.max(this.chartData, function(d) {
                  return d.reference_avg;

        Function fetchIndicator has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              fetchIndicator: function(params, type, slugw) {
                var r = new $.Deferred();
                var promises = [];
        
                // Fetch all the indicators of this tab

          Function showRegion has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                showRegion: function(params) {
                  var datasetId =
                    SHOW_REQUEST_REGION_ID + '_' + params.iso + '_' + params.region;
                  return new Promise(
                    function(resolve, reject) {
          Severity: Minor
          Found in app/assets/javascripts/services/CountryService.js - About 1 hr to fix

            Function _createScales has 26 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;
            
            

              Consider simplifying this complex logical expression.
              Open

                      if (
                        (!this.status.get('dont_analyze') &&
                          (params.iso &&
                            params.iso.country &&
                            params.iso.country !== 'ALL')) ||
              Severity: Major
              Found in app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js - About 1 hr to fix

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

                      this.$document.on(
                        'keyup',
                        _.bind(function(e) {
                          if (e.keyCode === 27) {
                            this.hide();
                Severity: Major
                Found in app/assets/javascripts/views/SourceWindowView.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/views/ModalView.js on lines 43..50

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

                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

                        var dashedLine = this.svg
                          .append('g')
                          .attr('class', 'line-semidashed-group')
                          .attr(
                            'transform',
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 499..505
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 540..546
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 623..629

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

                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

                      this.$document.on(
                        'keyup',
                        _.bind(function(e) {
                          if (e.keyCode === 27) {
                            this.hide();
                Severity: Major
                Found in app/assets/javascripts/views/ModalView.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/views/SourceWindowView.js on lines 52..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 55.

                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

                        var dashedLine = this.svg
                          .append('g')
                          .attr('class', 'line-dashed-group')
                          .attr(
                            'transform',
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 499..505
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 584..590
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 623..629

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

                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

                        var dotsGroup = this.svg
                          .append('g')
                          .attr('class', 'dots-group')
                          .attr(
                            'transform',
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 540..546
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 584..590
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 623..629

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

                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

                        var solidLineGroup = this.svg
                          .append('g')
                          .attr('class', 'line-solid-group')
                          .attr(
                            'transform',
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 499..505
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 540..546
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 584..590

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

                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

                      _renderNoDataPlaceHolder: function() {
                        var el = this.el.querySelector('#visMain');
                        var chartEl = el.querySelector('.chart');
                
                        chartEl.innerHTML = "There's no data available for this selection";
                app/assets/javascripts/insights/views/InsightsGladAlertsView.js on lines 198..203

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

                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

                    _renderNoDataPlaceHolder: function() {
                      var el = this.el.querySelector('#visMain');
                      var chartEl = el.querySelector('.chart');
                
                      chartEl.innerHTML = 'There\'s no data available for this selection';
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsView.js on lines 231..236

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

                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

                          var country = _.find(
                            amplify.store('countries'),
                            _.bind(function(country) {
                              return country.iso === this.iso;
                            }, this)
                Severity: Minor
                Found in app/assets/javascripts/map/views/tabs/CountriesView.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/map/views/LayersNavView.js on lines 403..408

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

                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

                      _getIso: function() {
                        var country = this.currentCountry;
                        var re = /(\d+)/g;
                        var subst = '-$1';
                
                
                app/assets/javascripts/insights/views/InsightsGladAlertsView.js on lines 235..242

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

                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

                        var country = _.find(
                          amplify.store('countries'),
                          _.bind(function(country) {
                            return country.iso === this.iso;
                          }, this)
                Severity: Minor
                Found in app/assets/javascripts/map/views/LayersNavView.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/map/views/tabs/CountriesView.js on lines 387..392

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

                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

                    _getIso: function() {
                      var country = this.currentCountry;
                      var re = /(\d+)/g;
                      var subst = '-$1';
                
                
                Severity: Minor
                Found in app/assets/javascripts/insights/views/InsightsGladAlertsView.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsView.js on lines 274..281

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

                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

                      _subscriptions: [
                        {
                          'Place/go': function(params) {
                            this._onPlaceGo(params);
                          },
                app/assets/javascripts/compare/presenters/CompareMainPresenter.js on lines 26..35
                app/assets/javascripts/compare/presenters/CompareSelectorsPresenter.js on lines 26..35

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

                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