Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

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

      _setupGrid: function() {
        var promises = [];

        if (!!this.activeWidgets && !!this.activeWidgets.length) {
          this.destroy();
Severity: Major
Found in app/assets/javascripts/countries/views/show/reports/NationalView.js - About 2 hrs to fix

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

    define(
      [
        'abstract/layer/CartoDBLayerClass',
        'text!map/cartocss/drc_primary_forest.cartocss'
      ],
    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/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

    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/ProdesLayer.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/map/views/layers/FormaLayer.js on lines 16..23

    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

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

            if (!!!this.currentDate[0]._d) {
              this.currentDate[0] = moment(this.currentDate[0]);
              this.currentDate[1] = moment(this.currentDate[1]);
            }
    app/assets/javascripts/abstract/timeline/TimelineYearClass.js on lines 132..135
    app/assets/javascripts/map/views/layers/BiomassLossLayer.js on lines 67..70
    app/assets/javascripts/map/views/layers/LossLayer.js on lines 51..54

    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 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/countries/views/pantropical/vis.js - About 2 hrs to fix

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

              if (!!!this.currentDate[0]._d) {
                this.currentDate[0] = moment(this.currentDate[0]);
                this.currentDate[1] = moment(this.currentDate[1]);
              }
      Severity: Major
      Found in app/assets/javascripts/map/views/layers/LossLayer.js and 3 other locations - About 2 hrs to fix
      app/assets/javascripts/abstract/timeline/TimelineYearClass.js on lines 132..135
      app/assets/javascripts/abstract/timeline/TimelineYearClass.js on lines 235..238
      app/assets/javascripts/map/views/layers/BiomassLossLayer.js on lines 67..70

      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/per_minam_cover.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/UptakeCropsCarbonGainLayer.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/UptakePasturesCarbonGainLayer.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

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

            _updateUncertainty: function(uncertainty) {
              switch (uncertainty) {
                case 'min':
                  this.uncertainty = 0;
                  break;
      Severity: Major
      Found in app/assets/javascripts/map/views/layers/BiomassLossLayer.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/map/views/layers/CarbonStocksLayer.js on lines 121..135

      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

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

              if (!!!this.currentDate[0]._d) {
                this.currentDate[0] = moment(this.currentDate[0]);
                this.currentDate[1] = moment(this.currentDate[1]);
              }
      app/assets/javascripts/abstract/timeline/TimelineYearClass.js on lines 235..238
      app/assets/javascripts/map/views/layers/BiomassLossLayer.js on lines 67..70
      app/assets/javascripts/map/views/layers/LossLayer.js on lines 51..54

      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

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

              if (!!!this.currentDate[0]._d) {
                this.currentDate[0] = moment(this.currentDate[0]);
                this.currentDate[1] = moment(this.currentDate[1]);
              }
      Severity: Major
      Found in app/assets/javascripts/map/views/layers/BiomassLossLayer.js and 3 other locations - About 2 hrs to fix
      app/assets/javascripts/abstract/timeline/TimelineYearClass.js on lines 132..135
      app/assets/javascripts/abstract/timeline/TimelineYearClass.js on lines 235..238
      app/assets/javascripts/map/views/layers/LossLayer.js on lines 51..54

      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/idn_peat.cartocss'],
        function(CartoDBLayerClass, idn_peatCartoCSS) {
          'use strict';
      
      
      app/assets/javascripts/map/views/layers/DrcPrimaryForestLayer.js on lines 6..29
      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/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

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

            _updateUncertainty: function(uncertainty) {
              switch (uncertainty) {
                case 'min':
                  this.uncertainty = 0;
                  break;
      Severity: Major
      Found in app/assets/javascripts/map/views/layers/CarbonStocksLayer.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/map/views/layers/BiomassLossLayer.js on lines 149..163

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

            _initModules: function() {
              this._initSlides();
              this.summaryChart = new SummaryChartView({
                data: this.data.emissions,
                country: this.data.country,
      Severity: Major
      Found in app/assets/javascripts/countries/views/CountryReportView.js - About 2 hrs to fix

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

              _setMaxWeek: function(data) {
                var lastValue =
                  data && data[data.length - 1] ? data[data.length - 1] : [];
        
                if (lastValue) {
        app/assets/javascripts/insights/views/InsightsGladAlertsView.js on lines 226..233

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

            _setMaxWeek: function(data) {
              var lastValue = data && data[data.length - 1] ?
                data[data.length - 1] : [];
        
              if (lastValue) {
        app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsView.js on lines 265..272

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

              toggleDisabled: function() {
                _.each(this.$selectsYear, function(el) {
                  var $options = document.getElementById($(el).attr('id')).options;
                  var compare = $($(el).data('compare'))[0].selectedIndex;
                  var direction = Boolean(parseInt($(el).data('direction')));
        Severity: Major
        Found in app/assets/javascripts/abstract/timeline/TimelineMonthClass.js - About 2 hrs to fix

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

            PieChart.prototype.render = function() {
              if (!!this.data.length) {
                var g = svg
                  .selectAll('.arc')
                  .data(pie(this.data))
          Severity: Major
          Found in app/assets/javascripts/widgets/indicators/pie/PieChart.js - About 2 hrs to fix

            Function set_up_html has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    (Chosen.prototype.set_up_html = function() {
                      var b, c;
                      return (
                        (b = ['chosen-container']),
                        b.push(
            Severity: Major
            Found in app/assets/javascripts/chosen.jquery.min.js - About 2 hrs to fix

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

                    (this.width = this.parentWidth - this.sizing.left - this.sizing.right),
                      (this.height =
                        this.parentHeight - this.sizing.top - this.sizing.bottom);
              app/assets/javascripts/widgets/indicators/line/LineChart.js on lines 37..39
              app/assets/javascripts/widgets/indicators/stacked/StackedChart.js on lines 32..34

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

              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