Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

Function display_by_ny has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      (BubbleChart.prototype.display_by_ny = function() {
        this.force
          .gravity(this.layout_gravity)
          .charge(this.charge)
          .friction(0.9)
Severity: Minor
Found in app/assets/javascripts/embed/views/pantropical/vis.js - About 1 hr to fix

    Function display_by_ny has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          (BubbleChart.prototype.display_by_ny = function() {
            this.force
              .gravity(this.layout_gravity)
              .charge(this.charge)
              .friction(0.9)
    Severity: Minor
    Found in app/assets/javascripts/countries/views/pantropical/vis.js - About 1 hr to fix

      Function welcome has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          welcome: function() {
            console.info(
              '%c .',
              "background-image: url('http://www.globalforestwatch.org/assets/logo-new.png'); width: 85px; height: 90px; float:left;font-size:82px; color: transparent;"
            );
      Severity: Minor
      Found in app/assets/javascripts/views/HeaderView.js - About 1 hr to fix

        Function _renderLegend has 40 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;
              }.bind(this))[0];
        
        
        Severity: Minor
        Found in app/assets/javascripts/insights/views/InsightsGladAlertsView.js - About 1 hr to fix

          Function _getLayerData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _getLayerData: function(layer, opts) {
                var unitsList = [];
                var selectedUnit =
                  !!opts.rangearray && opts.rangearray[layer.slug]
                    ? opts.rangearray[layer.slug].unit
          Severity: Minor
          Found in app/assets/javascripts/map/views/LegendView.js - About 1 hr to fix

            Function display_group_all has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                BubbleChart.prototype.display_group_all = function() {
                  this.force
                    .gravity(this.layout_gravity)
                    .charge(this.charge)
                    .friction(0.9)
            Severity: Minor
            Found in app/assets/javascripts/embed/views/pantropical/vis.js - About 1 hr to fix

              Function _drawAxis has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    _drawAxis: function() {
                      var _this = this;
              
                      // X Axis
                      var xAxis = this.svg

                Function display_group_all has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    BubbleChart.prototype.display_group_all = function() {
                      this.force
                        .gravity(this.layout_gravity)
                        .charge(this.charge)
                        .friction(0.9)
                Severity: Minor
                Found in app/assets/javascripts/countries/views/pantropical/vis.js - About 1 hr to fix

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

                        _setupGrid: function() {
                          var promises = [],
                            widgetsArray = [];
                  
                          _.map(

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

                          this.y = d3.scale
                            .linear()
                            .range([
                              this.height - this.options.innerPadding.bottom,
                              this.options.innerPadding.top
                    app/assets/javascripts/widgets/indicators/line/LineChart.js on lines 95..100

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

                    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

                          mps.subscribe(
                            'LineChart/mousemove' + this.options.slug + this.options.id,
                            function(x0) {
                              if (!!self.svg) {
                                self.setTooltip(x0, true);
                    app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 343..350
                    app/assets/javascripts/widgets/indicators/stacked/StackedChart.js on lines 333..340

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

                    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.y = d3.scale
                            .linear()
                            .range([
                              this.height - this.options.innerPadding.bottom,
                              this.options.innerPadding.top
                    Severity: Major
                    Found in app/assets/javascripts/widgets/indicators/line/LineChart.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 85..90

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

                    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

                              mps.subscribe(
                                'LineChart/mousemove' + this.options.slug + this.options.id,
                                function(x0) {
                                  if (!!self.svg) {
                                    self.setTooltip(x0, true);
                    app/assets/javascripts/widgets/indicators/line/LineChart.js on lines 326..333
                    app/assets/javascripts/widgets/indicators/stacked/StackedChart.js on lines 333..340

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

                    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

                              mps.subscribe(
                                'StackedChart/mousemove' + this.options.slug + this.options.id,
                                function(x0) {
                                  if (!!self.svg) {
                                    self.setTooltip(x0, true);
                    app/assets/javascripts/widgets/indicators/line/LineChart.js on lines 326..333
                    app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 343..350

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

                    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 CustomTooltip has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function CustomTooltip(tooltipId, width) {
                      var tooltipId = tooltipId;
                      $('#vis').append("<div class='tooltip' id='" + tooltipId + "'></div>");
                    
                      if (width) {
                    Severity: Minor
                    Found in app/assets/javascripts/embed/views/pantropical/vis.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function CustomTooltip has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function CustomTooltip(tooltipId, width) {
                      var tooltipId = tooltipId;
                      $('#vis').append("<div class='tooltip' id='" + tooltipId + "'></div>");
                    
                      if (width) {
                    Severity: Minor
                    Found in app/assets/javascripts/countries/views/pantropical/vis.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

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

                          initialize: function(layer, currentDate) {
                            this.layer = layer;
                            this.name = layer.slug;
                            this.options = _.extend({}, this.defaults, this.options || {});
                            this.dateRangeStart = this.options.dateRange[0];
                    Severity: Minor
                    Found in app/assets/javascripts/abstract/timeline/TimelineMonthClass.js - About 1 hr to fix

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

                          preCacheMonths: function(rows, coord, zoom, zoom_diff) {
                            var row, xcoords, ycoords, deforestation;
                      
                            if (typeof ArrayBuffer !== 'undefined') {
                              xcoords = new Uint8Array(new ArrayBuffer(rows.length));
                      Severity: Minor
                      Found in app/assets/javascripts/abstract/layer/CanvasJSONLayerClass.js - About 1 hr to fix

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

                              initialize: function(layer, currentDate) {
                                _.bindAll(this, '_onClickTick', '_selectDate');
                                this.layer = layer;
                                this.name = layer.slug;
                        
                        
                        Severity: Minor
                        Found in app/assets/javascripts/abstract/timeline/TimelineBtnClass.js - About 1 hr to fix

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

                                parseData: function(widget) {
                                  if (!widget)
                                    return {
                                      title: model.title,
                                      subtitle: 'No data download available'
                            Severity
                            Category
                            Status
                            Source
                            Language