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

          date[0] =
            date[0] != null
              ? !!date[0]._isAMomentObject ? date[0] : date[0].substr(0, 10)
              : '2001-01-01';
app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js on lines 600..603

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

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.status.set({
                country: params.country.iso,
                view: params.view,
                areas: null,
                jurisdictions: null,
app/assets/javascripts/countries/presenters/show/WidgetGridPresenter.js on lines 199..206

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

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

      changeWidgets: function(e) {
        this.presenter.changeActiveWidgets(
          $(e.currentTarget).data('id'),
          $(e.currentTarget).hasClass('is-active')
        );
app/assets/javascripts/countries/views/show/CountryWidgetsModalView.js on lines 166..171
app/assets/javascripts/countries/views/show/CountryWidgetsModalView.js on lines 173..178
app/assets/javascripts/countries/views/show/CountryWidgetsModalView.js on lines 180..185

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

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

      render: function() {
        this.$el.html(this.template());
        this.totalSteps = this.$('.step').length - 1;
      },
app/assets/javascripts/insights/views/carbon-cycle/CarbonInForestView.js on lines 83..86

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

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

      changeStartDate: function(e) {
        var startYear = $(e.currentTarget).val();
        ga('send', 'event', 'Widget', 'Start year', startYear);
        this.presenter.changeStartDate(startYear);
      },
Severity: Major
Found in app/assets/javascripts/widgets/views/TabView.js and 1 other location - About 1 hr to fix
app/assets/javascripts/widgets/views/TabView.js on lines 99..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 59.

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

    _parseData: function(data) {
      var dataList = [];
      _.each(data[0], function(value, key) {
        dataList.push({
          date: key,

    Function _selectDate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          _selectDate: function(date, el) {
            if (!el) {
              el = this.tickG
                .filter(function(d) {
                  var dformat = 'DD-MM-YYYY';
    Severity: Minor
    Found in app/assets/javascripts/abstract/timeline/TimelineBtnClass.js - About 1 hr to fix

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

          _parseData: function(data) {
            var dataList = [];
            _.each(data[0], function(value, key) {
              dataList.push({
                date: key,

        Function draw has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          CustomMarker.prototype.draw = function() {
            // Check if the div has been created.
            var div = this.div_;
        
            if (!div) {
        Severity: Minor
        Found in app/assets/javascripts/map/views/layers/CustomMarker.js - About 1 hr to fix

          Function getTile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getTile: function(coord, zoom, ownerDocument) {
                var zsteps = this._getZoomSteps(zoom);
          
                var url = this._getUrl.apply(
                  this,
          Severity: Minor
          Found in app/assets/javascripts/abstract/layer/ImageLayerClass.js - About 1 hr to fix

            Function getTile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getTile: function(coord, zoom, ownerDocument) {
                  var canvas = this._getCanvas(coord, zoom, ownerDocument);
                  var sql = this._getSQL(coord.x, coord.y, zoom);
                  var zoomDiff = zoom + 8 - Math.min(zoom + 8, 16);
            
            
            Severity: Minor
            Found in app/assets/javascripts/abstract/layer/CanvasJSONLayerClass.js - About 1 hr to fix

              Function drawMaskCountry has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    drawMaskCountry: function(geojson, iso) {
                      this.mask = cartodb.createLayer(this.map, {
                        user_name: 'wri-01',
                        type: 'cartodb',
                        cartodb_logo: false,
              Severity: Minor
              Found in app/assets/javascripts/map/views/tabs/AnalysisView.js - About 1 hr to fix

                Function _drawSolidLine has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      _drawSolidLine: function() {
                        var _this = this;
                        var solidLineGroup = this.svg
                          .append('g')
                          .attr('class', 'line-group')
                Severity: Minor
                Found in app/assets/javascripts/countries/views/report/SummaryChartView.js - About 1 hr to fix

                  Function _createStack has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      StackedChart.prototype._createStack = function() {
                        var self = this;
                        this.stacked = d3.layout.stack()(
                          this.data.map(function(d) {
                            return d.map(function(i) {
                  Severity: Minor
                  Found in app/assets/javascripts/widgets/indicators/stacked/StackedChart.js - About 1 hr to fix

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

                          initialize: function() {
                            enquire.register(
                              'screen and (max-width:' + window.gfw.config.GFW_MOBILE + 'px)',
                              {
                                match: _.bind(function() {
                    Severity: Minor
                    Found in app/assets/javascripts/compare/views/CompareIndexView.js - About 1 hr to fix

                      Function fetchIndicator has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            fetchIndicator: function(params, type, slugw) {
                              var r = new $.Deferred();
                              var promises = [];
                      
                              // Fetch all the indicators of this tab

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

                                } else if (resource.geostore) {
                                  p.geostore = resource.geostore;
                                } else if (resource.geojson) {
                                  p.geojson = encodeURIComponent(resource.geojson);
                                } else if (resource.wdpaid) {
                        app/assets/javascripts/map/presenters/tabs/SubscriptionPresenter.js on lines 519..527

                        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

                                var url = (function() {
                                  if (!!concessionsSql[layerSlug])
                                    return concessionsSql[layerSlug].format(useid);
                                  else
                                    return (
                        app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js on lines 490..500

                        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

                                var url = (function() {
                                  if (!!concessionsSql[layerSlug])
                                    return concessionsSql[layerSlug].format(useid);
                                  else
                                    return (
                        app/assets/javascripts/map/presenters/tabs/SubscriptionPresenter.js on lines 303..313

                        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_choices = this.container
                                          .find('ul.chosen-choices')
                                          .first()),
                                        (this.search_container = this.container
                                          .find('li.search-field')
                        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 549..554

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language