LearnPAd/learnpad

View on GitHub
lp-dashboard-kpi/lp-dash-adoxx-cockpit/src/main/webapp/ext-3.4.0/ux/gridfilters/GridFilters.js

Summary

Maintainability
D
2 days
Test Coverage

File GridFilters.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Ext JS Library 3.3.0
 * Copyright(c) 2006-2010 Ext JS, Inc.
 * licensing@extjs.com
 * http://www.extjs.com/license

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

    Ext.ux.grid.GridFilters = Ext.extend(Ext.util.Observable, {
        /**
         * @cfg {Boolean} autoReload
         * Defaults to true, reloading the datasource when a filter change happens.
         * Set this to false to prevent the datastore from being reloaded if there

      Function addFilters has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          addFilters : function (filters) {
              if (filters) {
                  var i, len, filter, cm = false, dI;
                  if (filters instanceof Ext.grid.ColumnModel) {
                      filters = filters.config;

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function buildQuery has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          buildQuery : function (filters) {
              var p = {}, i, f, root, dataPrefix, key, tmp,
                  len = filters.length;
      
              if (!this.encode){

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          init : function (grid) {
              if (grid instanceof Ext.grid.GridPanel) {
                  this.grid = grid;
      
                  this.bindStore(this.grid.getStore(), true);

        Function buildQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            buildQuery : function (filters) {
                var p = {}, i, f, root, dataPrefix, key, tmp,
                    len = filters.length;
        
                if (!this.encode){

          Function bindStore has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              bindStore : function(store, initial){
                  if(!initial && this.store){
                      if (this.local) {
                          store.un('load', this.onLoad, this);
                      } else {

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              init : function (grid) {
                  if (grid instanceof Ext.grid.GridPanel) {
                      this.grid = grid;
          
                      this.bindStore(this.grid.getStore(), true);

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function cleanParams has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              cleanParams : function (p) {
                  // if encoding just delete the property
                  if (this.encode) {
                      delete p[this.paramPrefix];
                  // otherwise scrub the object of filter data

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function reload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              reload : function () {
                  if (this.local) {
                      this.grid.store.clearFilter(true);
                      this.grid.store.filterBy(this.getRecordFilter());
                  } else {

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function applyState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              applyState : function (grid, state) {
                  var key, filter;
                  this.applyingState = true;
                  this.clearFilters();
                  if (state.filters) {

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function updateColumnHeadings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              updateColumnHeadings : function () {
                  var view = this.grid.getView(),
                      i, len, filter;
                  if (view.mainHd) {
                      for (i = 0, len = view.cm.config.length; i < len; i++) {

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

                      grid.on({
                          scope: this,
                          beforestaterestore: this.applyState,
                          beforestatesave: this.saveState,
                          beforedestroy: this.destroy,
          lp-dashboard-kpi/lp-dash-adoxx-cockpit/src/main/webapp/ext-3.4.0/pkgs/pkg-tips-debug.js on lines 1110..1116
          lp-dashboard-kpi/lp-dash-adoxx-cockpit/src/main/webapp/ext-3.4.0/pkgs/pkg-tree-debug.js on lines 4217..4223

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

          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(store){
                      if (this.local) {
                          store.on('load', this.onLoad, this);
                      } else {
                          store.on('beforeload', this.onBeforeLoad, this);
          lp-dashboard-kpi/lp-dash-adoxx-cockpit/src/main/webapp/ext-3.4.0/ux/gridfilters/GridFilters.js on lines 318..324

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

          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(!initial && this.store){
                      if (this.local) {
                          store.un('load', this.onLoad, this);
                      } else {
                          store.un('beforeload', this.onBeforeLoad, this);
          lp-dashboard-kpi/lp-dash-adoxx-cockpit/src/main/webapp/ext-3.4.0/ux/gridfilters/GridFilters.js on lines 325..331

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

          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