talho/openphin

View on GitHub
app/assets/javascripts/ext/src/widgets/form/BasicForm.js

Summary

Maintainability
D
2 days
Test Coverage

File BasicForm.js has 314 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
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js - About 3 hrs to fix

    BasicForm has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ext.form.BasicForm = Ext.extend(Ext.util.Observable, {
    
        constructor: function(el, config){
            Ext.apply(this, config);
            if(Ext.isString(this.paramOrder)){
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js - About 3 hrs to fix

      Function setValues has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          setValues : function(values){
              if(Ext.isArray(values)){ // array of objects
                  for(var i = 0, len = values.length; i < len; i++){
                      var v = values[i];
                      var f = this.findField(v.id);
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js - About 2 hrs to fix

      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 markInvalid has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          markInvalid : function(errors){
              if (Ext.isArray(errors)) {
                  for(var i = 0, len = errors.length; i < len; i++){
                      var fieldError = errors[i];
                      var f = this.findField(fieldError.id);
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js - About 1 hr to fix

      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 findField has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          findField : function(id) {
              var field = this.items.get(id);
      
              if (!Ext.isObject(field)) {
                  //searches for the field corresponding to the given id. Used recursively for composite fields
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js - About 1 hr to fix

      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 submit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          submit : function(options){
              options = options || {};
              if(this.standardSubmit){
                  var v = options.clientValidation === false || this.isValid();
                  if(v){
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js - About 55 mins to fix

      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 afterAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          afterAction : function(action, success){
              this.activeAction = null;
              var o = action.options;
              if(o.waitMsg){
                  if(this.waitMsgTarget === true){
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js - About 55 mins to fix

      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 beforeAction has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          beforeAction : function(action){
              // Call HtmlEditor's syncValue before actions
              this.items.each(function(f){
                  if(f.isFormField && f.syncValue){
                      f.syncValue();
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js - About 45 mins to fix

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

          applyIfToFields : function(o){
              this.items.each(function(f){
                 Ext.applyIf(f, o);
              });
              return this;
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js and 1 other location - About 40 mins to fix
      app/assets/javascripts/ext/src/widgets/form/BasicForm.js on lines 777..782

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

      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

          applyToFields : function(o){
              this.items.each(function(f){
                 Ext.apply(f, o);
              });
              return this;
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js and 1 other location - About 40 mins to fix
      app/assets/javascripts/ext/src/widgets/form/BasicForm.js on lines 789..794

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

      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(f){
                          f.setValue(v.value);
                          if(this.trackResetOnLoad){
                              f.originalValue = f.getValue();
                          }
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js and 1 other location - About 40 mins to fix
      app/assets/javascripts/ext/src/widgets/form/BasicForm.js on lines 642..647

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

      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(!Ext.isFunction(values[id]) && (field = this.findField(id))){
                          field.setValue(values[id]);
                          if(this.trackResetOnLoad){
                              field.originalValue = field.getValue();
                          }
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js and 1 other location - About 40 mins to fix
      app/assets/javascripts/ext/src/widgets/form/BasicForm.js on lines 632..637

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

      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

          reset : function(){
              this.items.each(function(f){
                  f.reset();
              });
              return this;
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js and 1 other location - About 35 mins to fix
      app/assets/javascripts/ext/src/widgets/form/BasicForm.js on lines 705..710

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

      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

          clearInvalid : function(){
              this.items.each(function(f){
                 f.clearInvalid();
              });
              return this;
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/BasicForm.js and 1 other location - About 35 mins to fix
      app/assets/javascripts/ext/src/widgets/form/BasicForm.js on lines 716..721

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

      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