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

        if (p.location) {
          var location = p.location.split('+');
          p.location = {
            iso: location[0],
            jurisdiction: ~~location[1],
Severity: Major
Found in app/assets/javascripts/embed/services/PlaceService.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/compare/services/PlaceService.js on lines 145..152

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

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

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

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

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

Refactorings

Further Reading

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

        if (view !== 'national') {
          this.$page1.removeClass('is-hidden');
          this.$page2.addClass('is-hidden');
        } else {
          this.$page1.addClass('is-hidden');
app/assets/javascripts/insights/views/emissions-calculator/EmissionCalculatorIndexView.js on lines 115..121

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

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

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

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

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

Refactorings

Further Reading

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

        if (p.compare1) {
          var splitCompare1 = p.compare1.split('+');
          p.compare1 = {
            iso: splitCompare1[0],
            jurisdiction: ~~splitCompare1[1],
Severity: Major
Found in app/assets/javascripts/compare/services/PlaceService.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/embed/services/PlaceService.js on lines 104..111

Duplicated Code

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

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

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

Tuning

This issue has a mass of 75.

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

      values.max =
        !!opts.rangearray && opts.rangearray[layer.slug]
          ? opts.rangearray[layer.slug].maxrange
          : false || (!!defaultRange ? defaultRange.max : null);
Severity: Major
Found in app/assets/javascripts/map/views/LegendView.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/map/views/LegendView.js on lines 501..504

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

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

          function(story) {
            story.title = _.str.truncate(story.title, 34);

            var markerOptions, infoWindowOptions;

Severity: Minor
Found in app/assets/javascripts/abstract/layer/MarkersLayerClass.js - About 1 hr to fix

    Function _appearMenu has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          _appearMenu() {
            $('body').mousemove(function(event) {
              if (event.pageY < 100) {
                $('#headerGfw').addClass('-show');
                $('.logo-menu').addClass('-show');
    Severity: Minor
    Found in app/assets/javascripts/map/views/MapView.js - About 1 hr to fix

      Function Place/go has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                'Place/go': function(p) {
                  var activeWidgetsIds = [],
                    jurisdictionsActive = [],
                    areasActive = [];
      
      

        Function _drawDeviation has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function _onPlaceGo has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                _onPlaceGo: function(params) {
                  switch (params.view) {
                    case 'national':
                      if (params.options) {
                        this._loadCustomizedOptions(params);

            Function set_default_values has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    (AbstractChosen.prototype.set_default_values = function() {
                      var a = this;
                      return (
                        (this.click_test_action = function(b) {
                          return a.test_active_click(b);
            Severity: Minor
            Found in app/assets/javascripts/chosen.jquery.min.js - About 1 hr to fix

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

                    var yAxis = d3.svg
                      .axis()
                      .scale(y)
                      .orient('left')
                      .ticks(7)
              app/assets/javascripts/embed/views/pantropical/PantropicalTotalEmissionsView.js on lines 102..109

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

              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.yAxis = d3.svg
                        .axis()
                        .scale(this.y)
                        .orient('left')
                        .innerTickSize(0)
              app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 356..363

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

              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.yAxis = d3.svg
                        .axis()
                        .scale(this.y)
                        .orient('left')
                        .innerTickSize(0)
              app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 286..293

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

              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

                    var yAxis = d3.svg
                      .axis()
                      .scale(y)
                      .orient('left')
                      .ticks(7)
              app/assets/javascripts/countries/views/pantropical/PantropicalTotalEmissionsView.js on lines 102..109

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

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

                    function mousemove() {
                      var x0 = x.invert(d3.mouse(this)[0]),
                        i = bisectDate(data, x0, 1),
                        d0 = data[i - 1],
                        d1 = data[i];

                Function mousemove has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function mousemove() {
                        var x0 = x.invert(d3.mouse(this)[0]),
                          i = bisectDate(data, x0, 1),
                          d0 = data[i - 1],
                          d1 = data[i];

                  Function filterCanvasImgdata has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        filterCanvasImgdata: function(imgdata, w, h) {
                          '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: Minor
                  Found in app/assets/javascripts/map/views/layers/CarbonStocksLayer.js - About 1 hr to fix

                    Function _drawData has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        StackedChart.prototype._drawData = function() {
                          var self = this;
                          this.bars = this.svg
                            .selectAll('.layer')
                            .data(this.stacked)
                    Severity: Minor
                    Found in app/assets/javascripts/widgets/indicators/stacked/StackedChart.js - About 1 hr to fix

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

                            _drawAxis: function() {
                              var _this = this;
                      
                              // X Axis
                              var xAxis = this.svg
                      Severity: Minor
                      Found in app/assets/javascripts/countries/views/report/SummaryChartView.js - About 1 hr to fix

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

                                enquire.register(
                                  'screen and (min-width:' + window.gfw.config.GFW_MOBILE + 'px)',
                                  {
                                    match: _.bind(function() {
                                      this.mobile = false;
                        Severity: Major
                        Found in app/assets/javascripts/map/views/tabs/CountriesView.js and 5 other locations - About 1 hr to fix
                        app/assets/javascripts/compare/views/index/CompareGridView.js on lines 25..33
                        app/assets/javascripts/compare/views/index/CompareGridView.js on lines 35..43
                        app/assets/javascripts/map/views/tabs/AnalysisView.js on lines 72..80
                        app/assets/javascripts/map/views/tabs/CountriesView.js on lines 85..93
                        app/assets/javascripts/widgets/views/WidgetView.js on lines 40..48

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

                        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