Vizzuality/gfw-climate

View on GitHub

Showing 1,213 of 1,213 total issues

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

define([], function() {
  'use strict';

  var darkMaptype = function() {
    var config = {
Severity: Major
Found in app/assets/javascripts/map/views/maptypes/darkMaptype.js and 2 other locations - About 5 hrs to fix
app/assets/javascripts/map/views/maptypes/positronMaptype.js on lines 4..28
app/assets/javascripts/map/views/maptypes/treeheightMaptype.js on lines 4..28

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

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

define([], function() {
  'use strict';

  var treeheightMaptype = function() {
    var config = {
app/assets/javascripts/map/views/maptypes/darkMaptype.js on lines 4..28
app/assets/javascripts/map/views/maptypes/positronMaptype.js on lines 4..28

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

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

define([], function() {
  'use strict';

  var osmMaptype = function() {
    var config = {
app/assets/javascripts/map/views/maptypes/darkMaptype.js on lines 4..28
app/assets/javascripts/map/views/maptypes/treeheightMaptype.js on lines 4..28

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

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

      changeIso: function(e) {
        this.iso = $(e.currentTarget).val();
        this.$countryButton.removeClass('disabled');
        this.area = null;
        if (this.iso) {
Severity: Major
Found in app/assets/javascripts/map/views/tabs/AnalysisView.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/map/views/tabs/SubscriptionView.js on lines 286..300

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

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

      changeIso: function(e) {
        this.iso = $(e.currentTarget).val();
        this.$countryButton.removeClass('disabled');
        this.area = null;
        if (this.iso) {
Severity: Major
Found in app/assets/javascripts/map/views/tabs/SubscriptionView.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/map/views/tabs/AnalysisView.js on lines 320..334

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

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

File InsightsGladAlertsView.js has 402 lines of code (exceeds 250 allowed). Consider refactoring.
Open

define([
  'backbone',
  'mps',
  'handlebars',
  'd3',
Severity: Minor
Found in app/assets/javascripts/insights/views/InsightsGladAlertsView.js - About 5 hrs to fix

    File SubscriptionPresenter.js has 400 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * The SubscriptionPresenter class for the AnalysisToolView.
     *
     * @return SubscriptionPresenter class.
     */
    Severity: Minor
    Found in app/assets/javascripts/map/presenters/tabs/SubscriptionPresenter.js - About 5 hrs to fix

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

      define(['underscore', 'mps', 'map/presenters/PresenterClass'], function(
        _,
        mps,
        PresenterClass
      ) {
      app/assets/javascripts/map/presenters/layers/FiresLayerPresenter.js on lines 6..36

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

      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

      define(['underscore', 'mps', 'map/presenters/PresenterClass'], function(
        _,
        mps,
        PresenterClass
      ) {
      app/assets/javascripts/map/presenters/layers/ModisLayerPresenter.js on lines 6..36

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

      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

            _generateLinkUrl: function(url, callback) {
              $.ajax({
                url:
                  'https://api-ssl.bitly.com/v3/shorten?longUrl=' +
                  encodeURIComponent(url) +
      Severity: Major
      Found in app/assets/javascripts/views/ShareView.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/widgets/views/ShareWidgetView.js on lines 160..184

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

      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

            getBitlyLink: function(url, callback) {
              $.ajax({
                url:
                  'https://api-ssl.bitly.com/v3/shorten?longUrl=' +
                  encodeURIComponent(url) +
      Severity: Major
      Found in app/assets/javascripts/widgets/views/ShareWidgetView.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/views/ShareView.js on lines 152..176

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

      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

      File LayersNavView.js has 394 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * The layers filter module.
       *
       * @return singleton instance of layers fitler class (extends Backbone.View).
       */
      Severity: Minor
      Found in app/assets/javascripts/map/views/LayersNavView.js - About 5 hrs to fix

        File SubscriptionView.js has 391 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * The SubscriptionView selector view.
         *
         * @return SubscriptionView instance (extends Backbone.View).
         */
        Severity: Minor
        Found in app/assets/javascripts/map/views/tabs/SubscriptionView.js - About 5 hrs to fix

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

                _toggleFilter: function(element, filter) {
                  var parent = this.el.querySelector('.' + element);
                  var selected = parent.querySelector(
                    '.' + this.defaults.selectedClassEl
                  );
          app/assets/javascripts/insights/views/InsightsGladAlertsView.js on lines 412..420

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

          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

              _toggleFilter: function(element, filter) {
                var parent = this.el.querySelector('.' + element);
                var selected = parent.querySelector('.' + this.defaults.selectedClassEl);
                var newSelection = parent.querySelector('[data-filter="'+ filter +'"]');
          
          
          app/assets/javascripts/insights/views/glad-alerts/InsightsGladAlertsView.js on lines 473..485

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

          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

          require(['backbone', 'insights/router'], function(Backbone, RouterView) {
            'use strict';
          
            var InsightsPage = Backbone.View.extend({
              el: document.body,
          Severity: Major
          Found in app/assets/javascripts/insights.js and 1 other location - About 5 hrs to fix
          app/assets/javascripts/countries.js on lines 13..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 142.

          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

          ], function(
            $,
            _,
            Backbone,
            Handlebars,
          Severity: Major
          Found in app/assets/javascripts/countries.js and 1 other location - About 5 hrs to fix
          app/assets/javascripts/insights.js on lines 4..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 142.

          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

                initialize: function() {
                  this.presenter = new FixedHeaderPresenter(this);
                  this.status = this.presenter.status;
                  // CACHE
                  this.$window = $(window);
          app/assets/javascripts/compare/views/index/CompareFixedHeaderView.js on lines 24..39

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

          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

                initialize: function() {
                  this.presenter = new CompareFixedHeaderPresenter(this);
                  this.status = this.presenter.status;
                  //CACHE
                  this.$window = $(window);
          app/assets/javascripts/countries/views/show/FixedHeaderView.js on lines 24..39

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

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

                setIndicator: function() {
                  var t = this.presenter.status.get('tabs');
                  var indicators;
                  if (t && t.type) {
                    switch (t.type) {
          Severity: Major
          Found in app/assets/javascripts/widgets/views/TabView.js - About 5 hrs to fix
            Severity
            Category
            Status
            Source
            Language