Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

Function _createLegend has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  PieChart.prototype._createLegend = function(mobile, mobileHeight) {
    var self = this;
    var legendDotSize = 12;
    var legendSpacing = 4;
    var widgetHeightMobile = mobileHeight;
Severity: Minor
Found in app/assets/javascripts/widgets/indicators/pie/PieChart.js - About 1 hr to fix

    Function _drawFooterBars has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          _drawFooterBars: function() {
            var rowOffset = this.defaults.rowHeight;
            var averageGroup = this.svg.select('.average');
            var leftOffset =
              d3.transform(averageGroup.attr('transform')).translate[0] +

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

            inits: function() {
              // countries
              this.setStyle();
              this.getCountries();
      
      
      Severity: Major
      Found in app/assets/javascripts/map/views/tabs/SubscriptionView.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/map/views/tabs/AnalysisView.js on lines 138..146

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

            inits: function() {
              // countries
              this.setStyle();
              this.getCountries();
      
      
      Severity: Major
      Found in app/assets/javascripts/map/views/tabs/AnalysisView.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/map/views/tabs/SubscriptionView.js on lines 103..111

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function _analyzeWdpai has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            _analyzeWdpai: function(wdpaid) {
              // Build resource
      
              this.wdpaidBool = this.wdpaid == wdpaid ? false : true;
              this.wdpaid = wdpaid;
      Severity: Minor
      Found in app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js - About 1 hr to fix

        Function _drawDots has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              _drawDots: function() {
                var _this = this;
                var dotsGroup = this.svg
                  .append('g')
                  .attr('class', 'dots-group')
        Severity: Minor
        Found in app/assets/javascripts/countries/views/report/SummaryChartView.js - About 1 hr to fix

          Function _setupGrid has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                _setupGrid: function() {
                  var promises = [],
                    widgetsArray = [];
          
                  _.map(
          Severity: Minor
          Found in app/assets/javascripts/countries/views/show/reports/AreasView.js - About 1 hr to fix

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

                  this.x = d3.scale
                    .ordinal()
                    .rangeRoundBands([
                      this.options.innerPadding.left,
                      this.width - this.options.innerPadding.right
            app/assets/javascripts/widgets/indicators/line/LineChart.js on lines 80..85
            app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 76..81

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

            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

                  this.x = d3.time
                    .scale()
                    .range([
                      this.options.innerPadding.left,
                      this.width - this.options.innerPadding.right
            app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 76..81
            app/assets/javascripts/widgets/indicators/stacked/StackedChart.js on lines 111..116

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

            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

                changeUnit: function(unit) {
                  var tabs = _.clone(this.status.get('tabs'));
                  tabs.unit = unit;
                  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 61..65

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

            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

                changeSection: function(section) {
                  var tabs = _.clone(this.status.get('tabs'));
                  tabs.section = section;
                  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 43..47

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

            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

                  this.x = d3.time
                    .scale()
                    .range([
                      this.options.innerPadding.left,
                      this.width - this.options.innerPadding.right
            app/assets/javascripts/widgets/indicators/line/LineChart.js on lines 80..85
            app/assets/javascripts/widgets/indicators/stacked/StackedChart.js on lines 111..116

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

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

                  _getAnalysisResource: function(results, layer) {
                    var p = {};
                    var params = this.status.attributes.resource;
                    var data = results.data.attributes;
            
            

              Function _drawGraph has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    _drawGraph: function() {
                      var $graphContainer = this.$el.find('.linechart-graph')[0];
                      // Set range
                      if (this.model.get('lock')) {
                        var data = this.getData('data'),

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

                        if (resource.iso) {
                          p.iso = {};
                          p.iso.country = resource.iso;
                          p.iso.region = resource.id1 ? resource.id1 : null;
                        } else if (resource.geojson) {
                app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js on lines 797..807

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

                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 (resource.iso) {
                          p.iso = {};
                          p.iso.country = resource.iso;
                          p.iso.region = resource.id1 ? resource.id1 : null;
                        } else if (resource.geostore) {
                app/assets/javascripts/map/presenters/tabs/SubscriptionPresenter.js on lines 519..527

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

                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

                      _onOverlayComplete: function(e) {
                        ga('send', 'event', 'Map', 'Analysis', 'Polygon: complete');
                        this.presenter.onOverlayComplete(e);
                        this._resetDrawing();
                        // buttons clases
                Severity: Major
                Found in app/assets/javascripts/map/views/tabs/SubscriptionView.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/map/views/tabs/AnalysisView.js on lines 463..469

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

                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

                      _onOverlayComplete: function(e) {
                        ga('send', 'event', 'Map', 'Analysis', 'Polygon: complete');
                        this.presenter.onOverlayComplete(e);
                        this._resetDrawing();
                        // buttons clases
                Severity: Major
                Found in app/assets/javascripts/map/views/tabs/AnalysisView.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/map/views/tabs/SubscriptionView.js on lines 408..414

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

                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 (event.pageY < 100) {
                            $('#headerGfw').addClass('-show');
                            $('.logo-menu').addClass('-show');
                            $('.nav-sections').addClass('-show');
                            $('.layout-header-bottom').addClass('-show');
                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 657..673

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

                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/wwf.cartocss'],
                  function(CartoDBLayerClass, wwfCartoCSS) {
                    'use strict';
                
                
                Severity: Major
                Found in app/assets/javascripts/map/views/layers/WWFLayer.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/map/views/layers/ConcesionesForestalesNotSupervisedLayer.js on lines 6..27

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

                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