Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

Function setListeners has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      setListeners: function() {
        this.$input.on(
          'keyup',
          _.bind(function(e) {
            if (e.keyCode === 27) {
Severity: Major
Found in app/assets/javascripts/map/views/controls/SearchboxView.js - About 2 hrs to fix

    Function _drawGridFooter has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          _drawGridFooter: function() {
            var rowOffset = this.defaults.rowHeight * 2.5;
    
            var grid = this.svg
              .append('g')

      File ShareView.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * The ShareView selector view.
       *
       * @return ShareView instance (extends Backbone.View).
       */
      Severity: Minor
      Found in app/assets/javascripts/views/ShareView.js - About 2 hrs to fix

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

                var deviationContent = this.svg
                  .append('g')
                  .attr(
                    'transform',
                    'translate(' +
        app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 394..403
        app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 441..450
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 345..354
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 387..396

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

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

                var lossContent = this.svg
                  .append('g')
                  .attr(
                    'transform',
                    'translate(' +
        app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 394..403
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 345..354
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 387..396
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 459..468

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

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

                var provincesContent = this.svg
                  .append('g')
                  .attr(
                    'transform',
                    'translate(' +
        app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 394..403
        app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 441..450
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 387..396
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 459..468

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

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

                var lossContent = this.svg
                  .append('g')
                  .attr(
                    'transform',
                    'translate(' +
        app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 394..403
        app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 441..450
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 345..354
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 459..468

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

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

                var yearsContent = this.svg
                  .append('g')
                  .attr(
                    'transform',
                    'translate(' +
        app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 441..450
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 345..354
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 387..396
        app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 459..468

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

        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

                      return _this.circles
                        .each(_this.mandatorySort(e.alpha))
                        .each(_this.buoyancy(e.alpha))
                        .attr('cx', function(d) {
                          return d.x - 135;
        Severity: Major
        Found in app/assets/javascripts/embed/views/pantropical/vis.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/embed/views/pantropical/vis.js on lines 433..441

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

        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

              {
                'AnalysisTool/stop-drawing': function() {
                  if (this.status.get('timeline')) {
                    this.view.model.set({ hidden: false });
                  }
        Severity: Major
        Found in app/assets/javascripts/map/presenters/TimelinePresenter.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/map/presenters/TimelinePresenter.js on lines 63..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 76.

        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

                        return _this.circles
                          .each(_this.mandatorySort(e.alpha))
                          .each(_this.buoyancy(e.alpha))
                          .attr('cx', function(d) {
                            return d.x - 115;
        Severity: Major
        Found in app/assets/javascripts/embed/views/pantropical/vis.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/embed/views/pantropical/vis.js on lines 494..502

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

        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

              {
                'AnalysisTool/start-drawing': function() {
                  if (this.status.get('timeline')) {
                    this.view.model.set({ hidden: true });
                  }
        Severity: Major
        Found in app/assets/javascripts/map/presenters/TimelinePresenter.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/map/presenters/TimelinePresenter.js on lines 55..62

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

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

                (AbstractChosen.prototype.winnow_results = function() {
                  var a, b, c, d, e, f, g, h, i, j, k, l;
                  for (
                    this.no_results_clear(),
                      d = 0,
        Severity: Major
        Found in app/assets/javascripts/chosen.jquery.min.js - About 2 hrs to fix

          Function _setUpGraph has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                _setUpGraph: function() {
                  var el = this.el;
                  var margin = this.defaults.margin;
                  var isDesforestation =
                    this.filter === this.defaults.desforestationFilter;

            Consider simplifying this complex logical expression.
            Open

                        if (
                          !hoverCarbonLoss &&
                          !hoverMenuLogin &&
                          !hoverCarbonGains &&
                          !hoverCarbonDensity &&
            Severity: Critical
            Found in app/assets/javascripts/map/views/MapView.js - About 2 hrs to fix

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

                      var yAxis = this.svg
                        .append('g')
                        .attr('class', 'y axis')
                        .attr(
                          'transform',
              app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 354..364

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

                    render: function(widgetsArray) {
                      this.activeWidgets = widgetsArray;
                      this.$el.html('');
              
                      this.$el.removeClass();
              Severity: Minor
              Found in app/assets/javascripts/countries/views/show/reports/AreasView.js - About 2 hrs to fix

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

                        var yAxis = this.svg
                          .append('g')
                          .attr('class', 'y axis')
                          .attr(
                            'transform',
                app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 448..458

                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 (i === 'continents') {
                          this.continentsEl.addClass('-active');
                          this.countriesEl.removeClass('-active');
                        } else {
                          this.continentsEl.removeClass('-active');
                app/assets/javascripts/countries/views/show/CountryWidgetsModalView.js on lines 220..226

                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.min =
                        !!opts.rangearray && opts.rangearray[layer.slug]
                          ? opts.rangearray[layer.slug].minrange
                          : false || (!!defaultRange ? defaultRange.min : 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 506..509

                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

                Severity
                Category
                Status
                Source
                Language