Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

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

    _defineRequests: function() {
      var cache = { type: 'persist', duration: 1, unit: 'days' };
      var url = this.url;
      var config = { cache: cache, url: url, type: 'GET', dataType: 'json' };
      ds.define(this.requestId, config);
app/assets/javascripts/map/services/MongabayStoryService.js on lines 30..35
app/assets/javascripts/map/services/UserStoryService.js on lines 25..30

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

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

    _defineRequests: function() {
      var cache = { type: 'persist', duration: 1, unit: 'days' };
      var url = this.url;
      var config = { cache: cache, url: url, type: 'GET', dataType: 'json' };
      ds.define(this.requestId, config);
Severity: Major
Found in app/assets/javascripts/map/services/MongabayStoryService.js and 2 other locations - About 2 hrs to fix
app/assets/javascripts/map/services/InfoamazoniaStoryService.js on lines 30..35
app/assets/javascripts/map/services/UserStoryService.js on lines 25..30

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

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

    _defineRequests: function() {
      var cache = { type: 'persist', duration: 1, unit: 'days' };
      var url = this.url;
      var config = { cache: cache, url: url, type: 'GET', dataType: 'json' };
      ds.define(this.requestId, config);
Severity: Major
Found in app/assets/javascripts/map/services/UserStoryService.js and 2 other locations - About 2 hrs to fix
app/assets/javascripts/map/services/InfoamazoniaStoryService.js on lines 30..35
app/assets/javascripts/map/services/MongabayStoryService.js on lines 30..35

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

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

    LineChart.prototype._createEl = function() {
      this.svg = d3
        .select(this.options.el)
        .append('svg')
        .attr('class', 'lineChart')
Severity: Major
Found in app/assets/javascripts/widgets/indicators/line/LineChart.js and 2 other locations - About 2 hrs to fix
app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 62..69
app/assets/javascripts/widgets/indicators/stacked/StackedChart.js on lines 64..71

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

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

      infowindowsButtons: function() {
        var cartoPopup = $('.cartodb-popup');
        cartoPopup.off('click');
        cartoPopup.on('click', '.analyze-concession', function(e) {
          $('.cartodb-infowindow').hide(0);
Severity: Major
Found in app/assets/javascripts/abstract/layer/CartoDBLayerClass.js - About 2 hrs to fix

    File TabView.js has 280 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    define(
      [
        'backbone',
        'underscore',
        'handlebars',
    Severity: Minor
    Found in app/assets/javascripts/widgets/views/TabView.js - About 2 hrs to fix

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

              var svg = d3
                .select(el)
                .append('svg')
                .attr('width', this.cWidth + margin.left + margin.right + 'px')
                .attr('height', this.cHeight + margin.top + margin.bottom + 'px');
      app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 203..207
      app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 157..161
      app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 241..245
      app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 283..287

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

      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

            toggleLayer: function(layerSlug) {
              var where = [{ slug: layerSlug }];
      
              layerSpecService.toggle(
                where,
      Severity: Major
      Found in app/assets/javascripts/map/presenters/LayersNavPresenter.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/map/presenters/LegendPresenter.js on lines 118..128

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

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

              var svg = d3
                .select(el)
                .append('svg')
                .attr('width', this.cWidth + margin.left + margin.right + 'px')
                .attr('height', this.cHeight + margin.top + margin.bottom + 'px');
      app/assets/javascripts/countries/views/report/PieChartView.js on lines 149..153
      app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 157..161
      app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 241..245
      app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 283..287

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

      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

            toggleLayer: function(layerSlug) {
              var where = [{ slug: layerSlug }];
      
              layerSpecService.toggle(
                where,
      Severity: Major
      Found in app/assets/javascripts/map/presenters/LegendPresenter.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/map/presenters/LayersNavPresenter.js on lines 75..85

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

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

              var svg = d3
                .select(el)
                .append('svg')
                .attr('width', this.cWidth + margin.left + margin.right + 'px')
                .attr('height', this.cHeight + margin.top + margin.bottom + 'px');
      app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 203..207
      app/assets/javascripts/countries/views/report/PieChartView.js on lines 149..153
      app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 241..245
      app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 283..287

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

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

              var svg = d3
                .select(el)
                .append('svg')
                .attr('width', this.cWidth + margin.left + margin.right + 'px')
                .attr('height', this.cHeight + margin.top + margin.bottom + 'px');
      app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 203..207
      app/assets/javascripts/countries/views/report/PieChartView.js on lines 149..153
      app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 157..161
      app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsChartView.js on lines 283..287

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

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

              var svg = d3
                .select(el)
                .append('svg')
                .attr('width', this.cWidth + margin.left + margin.right + 'px')
                .attr('height', this.cHeight + margin.top + margin.bottom + 'px');
      app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 203..207
      app/assets/javascripts/countries/views/report/PieChartView.js on lines 149..153
      app/assets/javascripts/countries/views/report/ProvincesTopChartView.js on lines 157..161
      app/assets/javascripts/countries/views/report/SummaryChartView.js on lines 241..245

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

      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 yearsGroup = yearsContent
                .selectAll('g')
                .data(this.chartData)
                .enter()
                .append('g')
      app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 563..573

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

      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 barGroup = barsContent
                .selectAll('g')
                .data(this.chartData)
                .enter()
                .append('g')
      app/assets/javascripts/countries/views/report/HistoricalTrendChartView.js on lines 405..415

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

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

            _analyzeConcession: function(useid, layerSlug) {
              var resource = this._buildResource({
                useid: useid,
                use: layerSlug,
                type: 'other'
      Severity: Major
      Found in app/assets/javascripts/map/presenters/tabs/AnalysisPresenter.js - About 2 hrs to fix

        Function parseTemplate has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              parseTemplate: function() {
                var currentDate = moment();
                var totalReference = '';
                var totalMonitoring = '';
                var increase = '';
        Severity: Major
        Found in app/assets/javascripts/countries/views/CountryReportView.js - About 2 hrs to fix

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

                  enquire.register(
                    'screen and (min-width:' + window.gfw.config.GFW_MOBILE + 'px)',
                    {
                      match: _.bind(function() {
                        this.mobile = false;
          Severity: Major
          Found in app/assets/javascripts/map/views/MapView.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/map/views/MapView.js on lines 86..95

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

          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

              StackedChart.prototype.resize = function() {
                this.offResize();
                $(this.options.el)
                  .find('svg')
                  .remove();
          app/assets/javascripts/widgets/indicators/multiline/MultiLineChart.js on lines 53..60

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

          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

              LineChart.prototype.resize = function() {
                this.offResize();
                $(this.options.el)
                  .find('svg')
                  .remove();
          app/assets/javascripts/widgets/indicators/stacked/StackedChart.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 88.

          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