Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

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

    (BubbleChart.prototype.mandatorySort = function(alpha, filter) {
      var that = this;
      return function(d) {
        // if (! !!filter) {
        //   if (d.id == 103 || d.id == 104) return;
Severity: Major
Found in app/assets/javascripts/embed/views/pantropical/vis.js and 1 other location - About 1 day to fix
app/assets/javascripts/countries/views/pantropical/vis.js on lines 393..417

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

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

    (BubbleChart.prototype.mandatorySort = function(alpha, filter) {
      var that = this;
      return function(d) {
        // if (! !!filter) {
        //   if (d.id == 103 || d.id == 104) return;
Severity: Major
Found in app/assets/javascripts/countries/views/pantropical/vis.js and 1 other location - About 1 day to fix
app/assets/javascripts/embed/views/pantropical/vis.js on lines 392..416

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

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

    _getTileCoords: function(x, y, z) {
      if (z > this.options.dataMaxZoom) {
        x = Math.floor(x / Math.pow(2, z - this.options.dataMaxZoom));
        y = Math.floor(y / Math.pow(2, z - this.options.dataMaxZoom));
        z = this.options.dataMaxZoom;
Severity: Major
Found in app/assets/javascripts/abstract/layer/CanvasLayerClass.js and 1 other location - About 1 day to fix
app/assets/javascripts/abstract/layer/ImageLayerClass.js on lines 91..106

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

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

    _getTileCoords: function(x, y, z) {
      if (z > this.options.dataMaxZoom) {
        x = Math.floor(x / Math.pow(2, z - this.options.dataMaxZoom));
        y = Math.floor(y / Math.pow(2, z - this.options.dataMaxZoom));
        z = this.options.dataMaxZoom;
Severity: Major
Found in app/assets/javascripts/abstract/layer/ImageLayerClass.js and 1 other location - About 1 day to fix
app/assets/javascripts/abstract/layer/CanvasLayerClass.js on lines 159..174

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

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

File LegendView.js has 610 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Legend module.
 *
 * @return singleton instance of the legend class (extends Widget).
 */
Severity: Major
Found in app/assets/javascripts/map/views/LegendView.js - About 1 day to fix

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

                  _this.circles
                    .transition()
                    .duration(50)
                    .attr('r', function(d) {
                      if (!!!that.year_to_compare) {
    Severity: Major
    Found in app/assets/javascripts/countries/views/pantropical/vis.js and 1 other location - About 1 day to fix
    app/assets/javascripts/embed/views/pantropical/vis.js on lines 473..493

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

    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

                  _this.circles
                    .transition()
                    .duration(50)
                    .attr('r', function(d) {
                      if (!!!that.year_to_compare) {
    Severity: Major
    Found in app/assets/javascripts/embed/views/pantropical/vis.js and 1 other location - About 1 day to fix
    app/assets/javascripts/countries/views/pantropical/vis.js on lines 474..494

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

    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

    File AnalysisView.js has 576 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * The AnalysisView selector view.
     *
     * @return AnalysisView instance (extends Backbone.View).
     */
    Severity: Major
    Found in app/assets/javascripts/map/views/tabs/AnalysisView.js - About 1 day to fix

      File MapView.js has 575 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * The MapView class for the Google Map.
       *
       * @return MapView class (extends Backbone.View)
       */
      Severity: Major
      Found in app/assets/javascripts/map/views/MapView.js - About 1 day to fix

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

              this.svg
                .on('mouseenter', function() {
                  self.positioner.style('visibility', 'visible');
                  self.tooltip.style('visibility', 'visible');
                })
        Severity: Major
        Found in app/assets/javascripts/widgets/indicators/line/LineChart.js and 1 other location - About 1 day to fix
        app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 254..273

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

        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.svg
                .on('mouseenter', function() {
                  self.positioner.style('visibility', 'visible');
                  self.tooltip.style('visibility', 'visible');
                })
        app/assets/javascripts/widgets/indicators/line/LineChart.js on lines 240..259

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

        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

            initialize: function(params) {
              this.defaults = _.extend(this.defaults, params);
              this.legends = [];
              this.chartConfig = [];
              this.locations = [];
        app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsView.js on lines 75..89

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

        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

              initialize: function(params) {
                this.defaults = _.extend(this.defaults, params);
                this.legends = [];
                this.chartConfig = [];
                this.locations = [];
        app/assets/javascripts/insights/views/InsightsGladAlertsView.js on lines 59..74

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

        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

        File layersHelper.js has 551 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * Map layers slug with layer files. (like views and dialog templates)
         */
        define([
          // Layer views
        Severity: Major
        Found in app/assets/javascripts/map/helpers/layersHelper.js - About 1 day to fix

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

                  _.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')));
          
          
          app/assets/javascripts/abstract/timeline/TimelineYearClass.js on lines 151..167

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

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

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

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

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

          Refactorings

          Further Reading

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

                  _.each(this.$selects, function(el) {
                    var $options = document.getElementById($(el).attr('id')).options;
                    var compare = $($(el).data('compare'))[0].selectedIndex;
                    var direction = Boolean(parseInt($(el).data('direction')));
          
          
          app/assets/javascripts/abstract/timeline/TimelineMonthClass.js on lines 171..187

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

          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

          File TimelineYearClass.js has 543 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * The Timeline view module.
           *
           * Timeline for all layers configured by setting layer-specific options.
           *
          Severity: Major
          Found in app/assets/javascripts/abstract/timeline/TimelineYearClass.js - About 1 day to fix

            File TimelineMonthClass.js has 538 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * The Timeline view module.
             *
             * Timeline for all layers configured by setting layer-specific options.
             *
            Severity: Major
            Found in app/assets/javascripts/abstract/timeline/TimelineMonthClass.js - About 1 day to fix

              Function _renderChart has 217 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _renderChart: function(params) {
                    var elem = params.elem;
                    var elemAttr = elem.replace(/[#]|[.]/g, '');
                    var $el = $(elem);
                    var contentWidth = $el.width();

                Function _renderChart has 216 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _renderChart: function(params) {
                      var elem = params.elem;
                      var elemAttr = elem.replace(/[#]|[.]/g, '');
                      var $el = $(elem);
                      var contentWidth = $el.width();
                  Severity
                  Category
                  Status
                  Source
                  Language