Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

Similar blocks of code found in 6 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/widgets/views/WidgetView.js and 5 other locations - About 1 hr to fix
app/assets/javascripts/compare/views/index/CompareGridView.js on lines 25..33
app/assets/javascripts/compare/views/index/CompareGridView.js on lines 35..43
app/assets/javascripts/map/views/tabs/AnalysisView.js on lines 72..80
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 76..84
app/assets/javascripts/map/views/tabs/CountriesView.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 73.

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

        enquire.register(
          'screen and (min-width:' + window.gfw.config.GFW_MOBILE + 'px)',
          {
            match: _.bind(function() {
              this.mobile = false;
app/assets/javascripts/compare/views/index/CompareGridView.js on lines 25..33
app/assets/javascripts/map/views/tabs/AnalysisView.js on lines 72..80
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 76..84
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 85..93
app/assets/javascripts/widgets/views/WidgetView.js on lines 40..48

Duplicated Code

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

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

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

Tuning

This issue has a mass of 73.

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

        enquire.register(
          'screen and (max-width:' + window.gfw.config.GFW_MOBILE + 'px)',
          {
            match: _.bind(function() {
              this.mobile = true;
app/assets/javascripts/compare/views/index/CompareGridView.js on lines 35..43
app/assets/javascripts/map/views/tabs/AnalysisView.js on lines 72..80
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 76..84
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 85..93
app/assets/javascripts/widgets/views/WidgetView.js on lines 40..48

Duplicated Code

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

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

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

Tuning

This issue has a mass of 73.

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 6 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/tabs/AnalysisView.js and 5 other locations - About 1 hr to fix
app/assets/javascripts/compare/views/index/CompareGridView.js on lines 25..33
app/assets/javascripts/compare/views/index/CompareGridView.js on lines 35..43
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 76..84
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 85..93
app/assets/javascripts/widgets/views/WidgetView.js on lines 40..48

Duplicated Code

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

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

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

Tuning

This issue has a mass of 73.

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

        enquire.register(
          'screen and (max-width:' + window.gfw.config.GFW_MOBILE + 'px)',
          {
            match: _.bind(function() {
              this.mobile = true;
Severity: Major
Found in app/assets/javascripts/map/views/tabs/CountriesView.js and 5 other locations - About 1 hr to fix
app/assets/javascripts/compare/views/index/CompareGridView.js on lines 25..33
app/assets/javascripts/compare/views/index/CompareGridView.js on lines 35..43
app/assets/javascripts/map/views/tabs/AnalysisView.js on lines 72..80
app/assets/javascripts/map/views/tabs/CountriesView.js on lines 76..84
app/assets/javascripts/widgets/views/WidgetView.js on lines 40..48

Duplicated Code

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

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

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

Tuning

This issue has a mass of 73.

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

    BubbleChart.prototype.start = function() {
      return (this.force = d3.layout
        .force()
        .nodes(this.nodes)
        .size([this.width, this.height]));
Severity: Major
Found in app/assets/javascripts/countries/views/pantropical/vis.js and 1 other location - About 1 hr to fix
app/assets/javascripts/embed/views/pantropical/vis.js on lines 316..321

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

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

        enquire.register(
          'screen and (min-width:' + window.gfw.config.GFW_MOBILE + 'px)',
          {
            match: _.bind(function() {
              this.setElement('#layers-menu');
Severity: Major
Found in app/assets/javascripts/map/views/LayersNavView.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/LayersNavView.js on lines 63..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 73.

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 start =
          (moment(this.currentDate[0]).year() - 2004) * 23 +
          Math.ceil((moment(this.currentDate[0]).dayOfYear() - 1) / 16);
app/assets/javascripts/map/views/layers/TerraiCanvasLayer.js on lines 49..51

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

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 end =
          (moment(this.currentDate[1]).year() - 2004) * 23 +
          Math.floor((moment(this.currentDate[1]).dayOfYear() - 1) / 16);
app/assets/javascripts/map/views/layers/TerraiCanvasLayer.js on lines 45..47

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

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

    BubbleChart.prototype.start = function() {
      return (this.force = d3.layout
        .force()
        .nodes(this.nodes)
        .size([this.width, this.height]));
Severity: Major
Found in app/assets/javascripts/embed/views/pantropical/vis.js and 1 other location - About 1 hr to fix
app/assets/javascripts/countries/views/pantropical/vis.js on lines 316..321

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

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

        enquire.register(
          'screen and (max-width:' + window.gfw.config.GFW_MOBILE + 'px)',
          {
            match: _.bind(function() {
              this.setElement('#layers-tab');
Severity: Major
Found in app/assets/javascripts/map/views/LayersNavView.js and 1 other location - About 1 hr to fix
app/assets/javascripts/map/views/LayersNavView.js on lines 54..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 73.

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

Method parse_country_data_for has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_country_data_for(data, indicator, period=:reference)
    result = {}
    start_year = period == :reference ? @reference_start_year : @monitor_start_year
    end_year = period == :reference ? @reference_end_year : @monitor_end_year

Severity: Minor
Found in app/models/country_report.rb - About 1 hr to fix

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

              $(this).data('useid')
                ? ga(
                    'send',
                    'event',
                    'Map',
    Severity: Major
    Found in app/assets/javascripts/abstract/layer/CartoDBLayerClass.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/abstract/layer/CartoDBLayerClass.js on lines 129..142

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

    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).data('useid')
                  ? ga(
                      'send',
                      'event',
                      'Map',
    Severity: Major
    Found in app/assets/javascripts/abstract/layer/CartoDBLayerClass.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/abstract/layer/CartoDBLayerClass.js on lines 165..178

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

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

    function CustomTooltip(tooltipId, width) {
      var tooltipId = tooltipId;
      $('#vis').append("<div class='tooltip' id='" + tooltipId + "'></div>");
    
      if (width) {
    Severity: Minor
    Found in app/assets/javascripts/countries/views/pantropical/vis.js - About 1 hr to fix

      Function CustomTooltip has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function CustomTooltip(tooltipId, width) {
        var tooltipId = tooltipId;
        $('#vis').append("<div class='tooltip' id='" + tooltipId + "'></div>");
      
        if (width) {
      Severity: Minor
      Found in app/assets/javascripts/embed/views/pantropical/vis.js - About 1 hr to fix

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

              initialize: function(layer, currentDate) {
                _.bindAll(
                  this,
                  'onAnimationBrush',
                  'onBrush',
        Severity: Minor
        Found in app/assets/javascripts/abstract/timeline/TimelineYearClass.js - About 1 hr to fix

          Function printCountries has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                printCountries: function(countries) {
                  if (this.mobile) {
                    var options = '';
                    var letters = [];
                    _.each(
          Severity: Minor
          Found in app/assets/javascripts/map/views/tabs/CountriesView.js - About 1 hr to fix

            Function _subscribeConcession has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  _subscribeConcession: function(useid, layerSlug) {
                    var resource = this._buildResource({
                      useid: useid,
                      use: layerSlug,
                      type: 'other'
            Severity: Minor
            Found in app/assets/javascripts/map/presenters/tabs/SubscriptionPresenter.js - About 1 hr to fix

              Function _initYearSlider has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    _initYearSlider: function() {
                      nouislider.create(this.yearsSlider, {
                        start: [
                          this.defaults.startYear,
                          this.defaults.commonYear,
              Severity: Minor
              Found in app/assets/javascripts/countries/views/report/SummaryChartView.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language