Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

File SidebarNavView.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * The SidebarNavView view.
 */
define(['jquery', 'backbone', 'underscore', 'mps'], function(
  $,
Severity: Minor
Found in app/assets/javascripts/views/SidebarNavView.js - About 2 hrs to fix

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

          initialize: function(settings) {
            this.defaults = _.extend({}, this.defaults, settings);
            this.data = this.defaults.data;
    
            this._initChart();
    app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 66..74
    app/assets/javascripts/countries/views/report/PieChartView.js on lines 42..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 80.

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

          initialize: function(settings) {
            this.defaults = _.extend({}, this.defaults, settings);
            this.data = this.defaults.data;
    
            this._initChart();
    app/assets/javascripts/countries/views/report/PieChartView.js on lines 42..50
    app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 65..73

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

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

          initialize: function(settings) {
            this.defaults = _.extend({}, this.defaults, settings);
            this.data = this.defaults.data;
    
            this._initChart();
    app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 66..74
    app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 65..73

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

    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

          initialize: function(layer, currentDate) {
            this.options = {
              dateRange: [layer.mindate, layer.maxdate],
              playSpeed: 120
            };
    Severity: Major
    Found in app/assets/javascripts/map/views/timeline/FormaTimeline.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/map/views/timeline/TerraiTimeline.js on lines 21..29

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

    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

          initialize: function(layer, currentDate) {
            this.options = {
              dateRange: [layer.mindate, layer.maxdate],
              playSpeed: 120
            };
    Severity: Major
    Found in app/assets/javascripts/map/views/timeline/TerraiTimeline.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/map/views/timeline/FormaTimeline.js on lines 16..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 80.

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

          filterCanvasImgdata: function(imgdata, w, h, z) {
            'use asm';
            // We'll force the use of a 32bit integer wit `value |0`
            // More info here: http://asmjs.org/spec/latest/
            var components = 4 | 0,
    Severity: Major
    Found in app/assets/javascripts/map/views/layers/BiomassLossLayer.js - About 2 hrs to fix

      Function getOptions has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            getOptions: function(widgets, params) {
              var activeWidgets,
                r = {};
              var params = params ? params : this.status.get('options');
              activeWidgets = widgets ? widgets : this.status.get('defaultWidgets');

        Function render has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              render: function(widgetsArray) {
                this.activeWidgets = widgetsArray;
                this.$el.html('');
        
                this.$el.removeClass();

          Function _drawFooterDeviation has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                _drawFooterDeviation: function() {
                  var rowOffset = this.defaults.rowHeight;
                  var deviationGroup = this.svg.select('.deviation');
                  var deviationLabel = _.findWhere(this.defaults.labels, {
                    slug: 'deviation'

            Function display_by_change has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                BubbleChart.prototype.display_by_change = function(year) {
                  this.year_to_compare = year;
                  var that = this;
                  this.force
                    .gravity(this.layout_gravity)
            Severity: Major
            Found in app/assets/javascripts/embed/views/pantropical/vis.js - About 2 hrs to fix

              Function generateCircles has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  BubbleChart.prototype.generateCircles = function(values_array) {
                    var that = this;
                    var circles = that.circles;
                    var style_string;
              
              
              Severity: Major
              Found in app/assets/javascripts/embed/views/pantropical/vis.js - About 2 hrs to fix

                Function drawMaskArea has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      drawMaskArea: function(geojson, iso, region) {
                        this.mask = cartodb.createLayer(this.map, {
                          user_name: 'wri-01',
                          type: 'cartodb',
                          cartodb_logo: false,
                Severity: Major
                Found in app/assets/javascripts/map/views/tabs/AnalysisView.js - About 2 hrs to fix

                  Function _renderLegend has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        _renderLegend: function(el, data, filter) {
                          var current = _.filter(
                            data,
                            function(d) {
                              return d.week * 1 === this.currentStep;

                    Function get_coordinates has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        BubbleChart.prototype.get_coordinates = function(sorted_index) {
                          var dist_x = 125;
                          var dist_y = 55;
                          var offset_x = 150;
                          var offset_y = 50;
                    Severity: Major
                    Found in app/assets/javascripts/countries/views/pantropical/vis.js - About 2 hrs to fix

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

                            _drawGraph: function() {
                              var keys = { x: 'year', y: 'value' };
                              var parseDate = d3.time.format('%Y').parse;
                              var $graphContainer = this.$el.find('.linechart-graph')[0];
                              var data = _.compact(
                      Severity: Major
                      Found in app/assets/javascripts/widgets/indicators/line/LineChartIndicator.js - About 2 hrs to fix

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

                        define(
                          [
                            'abstract/layer/CartoDBLayerClass',
                            'text!map/cartocss/uptake_pastures.cartocss'
                          ],
                        app/assets/javascripts/map/views/layers/DrcPrimaryForestLayer.js on lines 6..29
                        app/assets/javascripts/map/views/layers/IdnPeatLandsLayer.js on lines 6..26
                        app/assets/javascripts/map/views/layers/PerMinamCoverLayer.js on lines 6..29
                        app/assets/javascripts/map/views/layers/UptakePasturesCarbonGainLayer.js on lines 6..29
                        app/assets/javascripts/map/views/layers/UptakeYSGCarbonGainLayer.js on lines 6..29

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

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

                        define(
                          [
                            'abstract/layer/CartoDBLayerClass',
                            'text!map/cartocss/uptake_pastures.cartocss'
                          ],
                        app/assets/javascripts/map/views/layers/DrcPrimaryForestLayer.js on lines 6..29
                        app/assets/javascripts/map/views/layers/IdnPeatLandsLayer.js on lines 6..26
                        app/assets/javascripts/map/views/layers/PerMinamCoverLayer.js on lines 6..29
                        app/assets/javascripts/map/views/layers/UptakeCropsCarbonGainLayer.js on lines 6..29
                        app/assets/javascripts/map/views/layers/UptakeYSGCarbonGainLayer.js on lines 6..29

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

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

                            BubbleChart.prototype.display_by_change = function(year) {
                              this.year_to_compare = year;
                              var that = this;
                              this.force
                                .gravity(this.layout_gravity)
                        Severity: Major
                        Found in app/assets/javascripts/countries/views/pantropical/vis.js - About 2 hrs to fix

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

                                init: function(layer, options, map) {
                                  this.presenter = new Presenter(this);
                                  this.currentDate = options.currentDate || [
                                    moment(layer.mindate),
                                    moment(layer.maxdate)
                          Severity: Major
                          Found in app/assets/javascripts/map/views/layers/FormaLayer.js and 1 other location - About 2 hrs to fix
                          app/assets/javascripts/map/views/layers/ProdesLayer.js on lines 25..32

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

                          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