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

            (c = a(b.target).hasClass('active-result')
              ? a(b.target)
              : a(b.target)
                  .parents('.active-result')
                  .first()),
Severity: Major
Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 1 hr to fix
app/assets/javascripts/chosen.jquery.min.js on lines 899..903

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

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.search_container = this.container
                  .find('div.chosen-search')
                  .first()),
                (this.selected_item = this.container
                  .find('.chosen-single')
Severity: Major
Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 1 hr to fix
app/assets/javascripts/chosen.jquery.min.js on lines 543..548

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

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

            (c = a(b.target).hasClass('active-result')
              ? a(b.target)
              : a(b.target)
                  .parents('.active-result')
                  .first()),
Severity: Major
Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 1 hr to fix
app/assets/javascripts/chosen.jquery.min.js on lines 884..888

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

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 initMap has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

        zoom,
        lat,
        lng,
        iso,
        maptype,
Severity: Major
Found in app/assets/javascripts/map/router.js - About 1 hr to fix

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

          _toggleLayer: function(event) {
            event && event.preventDefault();
            // this prevents layer change when you click in source link
            if (
              !$(event.target).hasClass('source') &&
    Severity: Minor
    Found in app/assets/javascripts/map/views/LayersNavView.js - About 1 hr to fix

      Function handleStepEnter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            handleStepEnter: function(data) {
              var step = parseInt(data.element.dataset.step, 10);
              if (this.currentStep !== step) {
                var scene = 'init';
                switch (step) {

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

              filterCanvasImgdata: function(imgdata, w, h, z) {
                var components = 4;
                var exp = z < 11 ? 0.3 + (z - 3) / 20 : 1;
                if (!!!this.currentDate[0]._d) {
                  this.currentDate[0] = moment(this.currentDate[0]);
        Severity: Minor
        Found in app/assets/javascripts/map/views/layers/LossLayer.js - About 1 hr to fix

          Function _setCurrentTooltip has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                _setCurrentTooltip: function(value) {
                  var currentStep = value || this.currentStep;
                  var current = d3.select('svg .dot-' + currentStep);
          
                  d3.selectAll('svg .dot').classed('hovered', false);

            Function _drawCanvasImage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _drawCanvasImage: function(canvasData) {
                  'use asm';
                  var canvas = canvasData.canvas,
                    ctx = canvas.getContext('2d'),
                    image = canvasData.image,
            Severity: Minor
            Found in app/assets/javascripts/abstract/layer/CanvasLayerClass.js - About 1 hr to fix

              Function onDownloadClick has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    onDownloadClick: function(e) {
                      e.preventDefault();
                      var downloadUrl = '/api/data_portal_downloads'; // TODO: move this to .env
                      var query = '';
                      var firstParam = true;
              Severity: Minor
              Found in app/assets/javascripts/data-download/views/DataDownloadIndexView.js - About 1 hr to fix

                Function searchCountries has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      searchCountries: function(e) {
                        // TODO: move this to the presenter
                        var searchText = this.$searchBox.val();
                        var val = $.trim(searchText)
                          .replace(/ +/g, ' ')
                Severity: Minor
                Found in app/assets/javascripts/views/shared/GeoListView.js - About 1 hr to fix

                  Function _onBrush has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        _onBrush: function(event) {
                          var value = this.xscale.invert(d3.mouse(event)[0]);
                          var rounded = Math.round(value);
                          var x = this.xscale(rounded);
                          var date = this._domainToDate(rounded);
                  Severity: Minor
                  Found in app/assets/javascripts/abstract/timeline/TimelineMonthClass.js - About 1 hr to fix

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

                          initialize: function() {
                            this.presenter = new Presenter(this);
                            this.layerInst = {};
                            this.$maplngLng = $('.map-container .map-latlng');
                            this.$viewFinder = $('#viewfinder');
                    Severity: Minor
                    Found in app/assets/javascripts/map/views/MapView.js - About 1 hr to fix

                      Function _parseData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            _parseData: function() {
                              this.chartData = [];
                      
                              for (var indicator in this.data) {
                                var current = this.data[indicator];

                        Function _createScales has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            StackedChart.prototype._createScales = function() {
                              var self = this;
                              this.xKey = this.options.keys.x;
                              this.yKey = this.options.keys.y;
                        
                        
                        Severity: Minor
                        Found in app/assets/javascripts/widgets/indicators/stacked/StackedChart.js - About 1 hr to fix

                          Function _drawTooltip has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

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

                                  _onPlaceGo: function(params) {
                                    if (!!params.compare1 && !!params.compare2) {
                                      // Fetching data
                                      var complete = _.invoke(
                                        [
                            Severity: Minor
                            Found in app/assets/javascripts/compare/presenters/CompareModalPresenter.js - About 1 hr to fix

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

                                  StackedChart.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/stacked/StackedChart.js - About 1 hr to fix

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

                                      init: function(router) {
                                        this.router = router;
                                        this._presenters = [];
                                        this._name = null;
                                        this._super();
                                Severity: Major
                                Found in app/assets/javascripts/services/PlaceService.js and 2 other locations - About 1 hr to fix
                                app/assets/javascripts/compare/services/PlaceService.js on lines 65..70
                                app/assets/javascripts/embed/services/PlaceService.js on lines 22..27

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

                                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

                                        barGroup
                                          .append('rect')
                                          .attr('class', function(d) {
                                            return 'bar ' + d.type;
                                          })
                                app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 575..590

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

                                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