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 (!!this.iso) {
            this.$countryReset.show(0);
            this.$countryBack.hide(0);
            this.$countryUl.addClass('hidden');
            this.$letters.parents('.letters-ul-mobile-box').addClass('hidden');
Severity: Major
Found in app/assets/javascripts/map/views/tabs/CountriesView.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 403..411

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

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

      render: function() {
        this.$el.html(this.template(this.parseData()));

        if (!!this.widgets && !!this.widgets.length) {
          this.destroy();
Severity: Major
Found in app/assets/javascripts/compare/views/index/CompareGridView.js - About 2 hrs to fix

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

          this.positioner = this.svg
            .append('svg:line')
            .attr('x1', 0)
            .attr('y1', 0)
            .attr('x2', 0)
    Severity: Major
    Found in app/assets/javascripts/widgets/indicators/line/LineChart.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 245..252

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

    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

          drawCountrypolygon: function(geojson, color) {
            var geojson = this.setGeojson(geojson, color);
            this.setStyle();
            var multipolygon = this.map.data.addGeoJson(geojson)[0];
            this.presenter.setMultipolygon(multipolygon, geojson);
    Severity: Major
    Found in app/assets/javascripts/map/views/tabs/AnalysisView.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/map/views/tabs/SubscriptionView.js on lines 481..486

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

    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

          setStatusValues: function() {
            var t = this.model.toJSON();
            if (!!t.section) {
              this.$section.val(t.section);
              this.$section_name.text(t.section);
    app/assets/javascripts/widgets/indicators/pie/PieChartIndicator.js on lines 128..134

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

    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

          _setDomain: function() {
            this.x.domain(this.domain.x);
            this.x2.domain(this.domain.x2);
            this.y.domain(this.domain.y);
          },
    app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 254..258

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

    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

          _unserializeParams: function(paramsQuery) {
            var params = {};
            if (typeof paramsQuery === 'string' && paramsQuery.length) {
              var uri = new URI();
              uri.query(paramsQuery);
    Severity: Major
    Found in app/assets/javascripts/insights/router.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/countries/router.js on lines 85..93

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

    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

          _unserializeParams: function(paramsQuery) {
            var params = {};
            if (typeof paramsQuery === 'string' && paramsQuery.length) {
              var uri = new URI();
              uri.query(paramsQuery);
    Severity: Major
    Found in app/assets/javascripts/countries/router.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/insights/router.js on lines 96..104

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

    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

          _setDomain: function() {
            this.x.domain(this.domain.x);
            this.x2.domain(this.domain.x2);
            this.y.domain(this.domain.y);
          },
    app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 208..212

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

    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

          setStatusValues: function() {
            var t = this.model.toJSON();
            if (!!t.section) {
              this.$section.val(t.section);
              this.$section_name.text(t.section);
    app/assets/javascripts/widgets/indicators/stacked/StackedChartIndicator.js on lines 139..145

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

    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

          drawCountrypolygon: function(geojson, color) {
            var geojson = this.setGeojson(geojson, color);
            this.setStyle();
            var multipolygon = this.map.data.addGeoJson(geojson)[0];
            this.presenter.setMultipolygon(multipolygon, geojson);
    Severity: Major
    Found in app/assets/javascripts/map/views/tabs/SubscriptionView.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/map/views/tabs/AnalysisView.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 81.

    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.positioner = this.svg
            .append('svg:line')
            .attr('x1', 0)
            .attr('y1', 0)
            .attr('x2', 0)
    app/assets/javascripts/widgets/indicators/line/LineChart.js on lines 231..238

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

    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

              _.each(
                _.sortBy(countries, function(country) {
                  return country.name;
                }),
                _.bind(function(country, i) {
    Severity: Major
    Found in app/assets/javascripts/map/views/tabs/CountriesView.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/map/views/tabs/SubscriptionView.js on lines 269..277

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

    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

            _.each(
              _.sortBy(subareas, function(area) {
                return area.name_1;
              }),
              _.bind(function(area, i) {
    Severity: Major
    Found in app/assets/javascripts/map/views/tabs/SubscriptionView.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/map/views/tabs/CountriesView.js on lines 289..301

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

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

          _analyzeIso: function(iso) {
            this.deleteAnalysis();
    
            this.view.setSelects(iso, this.status.get('dont_analyze'));
            mps.publish('LocalMode/updateIso', [
    Severity: Major
    Found in app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js - About 2 hrs to fix

      Function _addListeners has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            _addListeners: function() {
              google.maps.event.addListener(
                this.map,
                'zoom_changed',
                _.bind(function() {
      Severity: Major
      Found in app/assets/javascripts/map/views/MapView.js - About 2 hrs to fix

        Function _drawGrid has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              _drawGrid: function() {
                // X Lines
                var numLines = this.chartData.length;
                var rowOffset = this.defaults.rowHeight;
                var linesGroup = this.svg

          Function fetchData has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                fetchData: function(setup) {
                  var status = {
                    promises: []
                  };
                  _.each(

            Function _drawBars has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  _drawBars: function() {
                    var averageGroup = this.svg.select('.average');
                    var leftOffset =
                      d3.transform(averageGroup.attr('transform')).translate[0] +
                      this.defaults.barMargin;

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

                    _drawDeviation: function() {
                      var total = _.reduce(
                        this.referenceData.values,
                        function(memo, data) {
                          return memo + data.value;
                Severity
                Category
                Status
                Source
                Language