CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/cartodb/table/menu_modules/filters.js

Summary

Maintainability
D
2 days
Test Coverage

File filters.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
Open


cdb.admin.mod.Filters = cdb.admin.Module.extend({

    buttonClass: 'filters_mod',
    className: 'filters_panel',
Severity: Minor
Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js - About 4 hrs to fix

    Filters has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    cdb.admin.mod.Filters = cdb.admin.Module.extend({
    
        buttonClass: 'filters_mod',
        className: 'filters_panel',
        type: 'tool',
    Severity: Minor
    Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js - About 3 hrs to fix

      Function initFilters has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          initFilters: function() {
            // this function is attached to two changes that most of the time
            // are produced at the same time. Although signals are unbind backbone
            // does not support it
            if(this._initialized) {
      Severity: Major
      Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js - About 2 hrs to fix

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

            initialize: function() {
              _.bindAll(this, "loadScroll", "_refreshScroll");
              var self = this;
              this._initialized = false;
              this._filterViews = {};
        Severity: Minor
        Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js - About 1 hr to fix

          Function _addFilter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _addFilter: function(column) {
          
                var self = this;
          
                if (!column.has('column_type')) {
          Severity: Minor
          Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js - About 1 hr to fix

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

                _showQueryAppliedMessage: function() {
                  this.$el.find(".form_combo").hide();
                  this.$el.find(".help").hide();
                  this.$el.find(".applied_query").show();
                },
            Severity: Major
            Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js and 1 other location - About 2 hrs to fix
            lib/assets/javascripts/cartodb/table/menu_modules/filters.js on lines 454..458

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

            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

                _hideQueryAppliedMessage: function() {
                  this.$el.find(".applied_query").hide();
                  this.$el.find(".form_combo").show();
                  this.$el.find(".help").show();
                },
            Severity: Major
            Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js and 1 other location - About 2 hrs to fix
            lib/assets/javascripts/cartodb/table/menu_modules/filters.js on lines 460..464

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

            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

                _getFilterViewforColumnType: function(columnType) {
                  if (columnType == 'number' || columnType == 'date') {
                    return cdb.admin.mod.Filter;
                  } else {
                    return cdb.admin.mod.SelectorFilter;
            lib/assets/javascripts/cartodb/models/filter.js on lines 562..568

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

            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.innerColumnSelector = new cdb.forms.ColumnTypeCombo({
                    width: '200px',
                    placeholder: 'Select a column to filter by',
                    extra: comboData,
                    property: 'column',
            Severity: Minor
            Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js and 1 other location - About 50 mins to fix
            lib/assets/javascripts/cartodb/table/menu_modules/filters.js on lines 125..131

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

            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.columnSelector = new cdb.forms.ColumnTypeCombo({
                    width: '200px',
                    placeholder: 'Select a column to filter by',
                    extra: comboData,
                    property: 'column',
            Severity: Minor
            Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js and 1 other location - About 50 mins to fix
            lib/assets/javascripts/cartodb/table/menu_modules/filters.js on lines 114..120

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

            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

                _onClickHideFilterSelector: function(e) {
            
                  e.preventDefault();
                  e.stopPropagation();
            
            
            Severity: Minor
            Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js and 1 other location - About 35 mins to fix
            lib/assets/javascripts/cartodb/table/menu_modules/filters.js on lines 73..79

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

            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

                _onClickShowFilterSelector: function(e) {
                  e.preventDefault();
                  e.stopPropagation();
            
                  this.model.set("addMode", "combo");
            Severity: Minor
            Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js and 1 other location - About 35 mins to fix
            lib/assets/javascripts/cartodb/table/menu_modules/filters.js on lines 56..63

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

            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

                  if (_.size(self._filterViews) < 1) {
                    this.$el.find(".chooser").show();
                    this.$el.find(".add_filter").hide();
                  }
            Severity: Minor
            Found in lib/assets/javascripts/cartodb/table/menu_modules/filters.js and 1 other location - About 35 mins to fix
            lib/assets/javascripts/deep-insights/widgets/histogram/chart.js on lines 477..480

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

            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

            There are no issues that match your filters.

            Category
            Status