Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

Method show_query has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def show_query(indicator_id, iso, id_1, area, thresh_value)
      filter = <<-SQL
        indicator_id = #{indicator_id}
        AND value IS NOT NULL
        AND thresh = #{thresh_value}
Severity: Minor
Found in app/models/indicator.rb - About 1 hr to fix

    Function LineChart has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var LineChart = function(options) {
          this.svg;
          this.options = options;
          this.parent = options.parent;
          this.data = options.data;
    Severity: Minor
    Found in app/assets/javascripts/widgets/indicators/line/LineChart.js - About 1 hr to fix

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

          LineChart.prototype.setListeners = function() {
            var formatDate = d3.time.format('%Y');
            var bisectDate = d3.bisector(function(d) {
              return d.year;
            }).left;
      Severity: Minor
      Found in app/assets/javascripts/widgets/indicators/line/LineChart.js - About 1 hr to fix

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

              setMultipolygon: function(multipolygon, geojson) {
                this.deleteMultiPoligon();
                this.status.set('multipolygon', multipolygon);
                mps.publish('AnalysisTool/iso-drawn', [geojson.geometry]);
              },
        app/assets/javascripts/map/presenters/tabs/SubscriptionPresenter.js on lines 494..498

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

        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

              _updateUrl: function(viewId) {
                history.pushState(
                  '',
                  document.title,
                  window.location.origin + window.location.pathname + '?tab=' + viewId
        app/assets/javascripts/countries/views/CountryPantropicalView.js on lines 97..103

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

        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

              _updateUrl: function(viewId) {
                history.pushState(
                  '',
                  document.title,
                  window.location.origin + window.location.pathname + '?tab=' + viewId
        app/assets/javascripts/embed/views/pantropical/PantropicalView.js on lines 96..102

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

        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

              setMultipolygon: function(multipolygon, geojson) {
                this.deleteMultiPoligon();
                this.status.set('multipolygon', multipolygon);
                mps.publish('AnalysisTool/iso-drawn', [geojson.geometry]);
              },
        app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js on lines 772..776

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

        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

            execute: function(params, successCb, failureCb) {
              var config = {
                resourceId: this.requestId,
                data: params,
                success: successCb,
        Severity: Major
        Found in app/assets/javascripts/map/services/SitesService.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/map/services/RegionService.js on lines 45..54

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 56.

        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

            execute: function(data, successCb, failureCb) {
              var config = {
                resourceId: this.requestId,
                data: data,
                success: successCb,
        Severity: Major
        Found in app/assets/javascripts/map/services/RegionService.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/map/services/SitesService.js on lines 39..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 56.

        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

              cacheVars: function() {
                this.$section = this.$el.find('.section');
                this.$section_name = this.$el.find('.section-name');
              },
        app/assets/javascripts/map/views/tabs/SubscribeView.js on lines 47..50

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

        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

              cacheVars: function() {
                this.$content = this.$el.find('.analysis-subscribe-content');
                this.$steps = this.$el.find('.steps');
              },
        Severity: Major
        Found in app/assets/javascripts/map/views/tabs/SubscribeView.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/widgets/indicators/pie/PieChartIndicator.js on lines 123..126

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

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

              offsetCenter: function(latlng, offsetx, offsety) {
                // latlng is the apparent centre-point
                // offsetx is the distance you want that point to move to the right, in pixels
                // offsety is the distance you want that point to move upwards, in pixels
                // offset can be negative
        Severity: Minor
        Found in app/assets/javascripts/map/views/MapView.js - About 1 hr to fix

          Function _drawBrush has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                _drawBrush: function() {
                  this.brush = d3.svg
                    .brush()
                    .x(this.x2)
                    .extent([0, 0])

            Function updatePosition has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function updatePosition(event) {
                var ttid = '#' + tooltipId;
                var xOffset = -120;
                var yOffset = -70;
            
            
            Severity: Minor
            Found in app/assets/javascripts/embed/views/pantropical/vis.js - About 1 hr to fix

              Function _source has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    _source: function(id) {
                      var cxApiExists = !!cxApi || false;
                      if (cxApiExists) {
                        var variation = this.setVariation(id, 3);
              
              
              Severity: Minor
              Found in app/assets/javascripts/map/presenters/ExperimentsPresenter.js - About 1 hr to fix

                Function _onBrushEnd has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      _onBrushEnd: function() {
                        if (!d3.event.sourceEvent) return;
                        var domain = this._getDomain();
                        var xDomain = domain.x2;
                        var element = this.el.querySelector('svg .handles');

                  Function _toggleLayer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        _toggleLayer: function(layer) {
                          var current = this.model.getLayer({ slug: layer.slug });
                          var baselayers = this.model.getBaselayers();
                  
                          // At least one baselayer active.
                  Severity: Minor
                  Found in app/assets/javascripts/map/services/LayerSpecService.js - About 1 hr to fix

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

                          initialize: function(map) {
                            this.embed = $('body').hasClass('is-embed-action');
                            this.map = map;
                            this.model = new CountriesModel();
                            this.presenter = new Presenter(this);
                    Severity: Minor
                    Found in app/assets/javascripts/map/views/tabs/CountriesView.js - About 1 hr to fix

                      Function _toggleSelected has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            _toggleSelected: function(layers) {
                              this.layers = layers;
                      
                              // Toggle sublayers
                              _.each(this.$el.find('.layer'), function(li) {
                      Severity: Minor
                      Found in app/assets/javascripts/map/views/LayersNavView.js - About 1 hr to fix

                        Function keydown_checker has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                (Chosen.prototype.keydown_checker = function(a) {
                                  var b, c;
                                  switch (((b = null != (c = a.which) ? c : a.keyCode),
                                  this.search_field_scale(),
                                  8 !== b && this.pending_backstroke && this.clear_backstroke(),
                        Severity: Minor
                        Found in app/assets/javascripts/chosen.jquery.min.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language