talho/openphin

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

Summary

Maintainability
D
2 days
Test Coverage

Function getErrors has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    getErrors: function(value) {
        var errors = Ext.form.TextField.superclass.getErrors.apply(this, arguments);
        
        value = Ext.isDefined(value) ? value : this.processValue(this.getRawValue());        
        
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/form/TextField.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

TextField has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

Ext.form.TextField = Ext.extend(Ext.form.Field,  {
    /**
     * @cfg {String} vtypeText A custom error message to display in place of the default message provided
     * for the <b><code>{@link #vtype}</code></b> currently set for this field (defaults to <tt>''</tt>).  <b>Note</b>:
     * only applies if <b><code>{@link #vtype}</code></b> is set, else ignored.
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/form/TextField.js - About 2 hrs to fix

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

        getErrors: function(value) {
            var errors = Ext.form.TextField.superclass.getErrors.apply(this, arguments);
            
            value = Ext.isDefined(value) ? value : this.processValue(this.getRawValue());        
            
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/form/TextField.js - About 1 hr to fix

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

          selectText : function(start, end){
              var v = this.getRawValue();
              var doFocus = false;
              if(v.length > 0){
                  start = start === undefined ? 0 : start;
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/TextField.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 initEvents has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          initEvents : function(){
              Ext.form.TextField.superclass.initEvents.call(this);
              if(this.validationEvent == 'keyup'){
                  this.validationTask = new Ext.util.DelayedTask(this.validate, this);
                  this.mon(this.el, 'keyup', this.filterValidation, this);
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/TextField.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 initEvents has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          initEvents : function(){
              Ext.form.TextField.superclass.initEvents.call(this);
              if(this.validationEvent == 'keyup'){
                  this.validationTask = new Ext.util.DelayedTask(this.validate, this);
                  this.mon(this.el, 'keyup', this.filterValidation, this);
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/TextField.js - About 1 hr to fix

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

            filterKeys : function(e){
                if(e.ctrlKey){
                    return;
                }
                var k = e.getKey();
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/form/TextField.js - About 35 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

            onDestroy: function(){
                if(this.validationTask){
                    this.validationTask.cancel();
                    this.validationTask = null;
                }
        Severity: Major
        Found in app/assets/javascripts/ext/src/widgets/form/TextField.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/ext/src/widgets/form/RadioGroup.js on lines 112..118

        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

            onEnable: function(){
                Ext.form.TextField.superclass.onEnable.call(this);
                if(Ext.isIE){
                    this.el.dom.unselectable = '';
                }
        Severity: Major
        Found in app/assets/javascripts/ext/src/widgets/form/TextField.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/ext/src/widgets/form/TextField.js on lines 264..269

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

        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

            onDisable: function(){
                Ext.form.TextField.superclass.onDisable.call(this);
                if(Ext.isIE){
                    this.el.dom.unselectable = 'on';
                }
        Severity: Major
        Found in app/assets/javascripts/ext/src/widgets/form/TextField.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/ext/src/widgets/form/TextField.js on lines 272..277

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

        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

                    this.mon(this.el, {
                        scope: this,
                        keyup: this.onKeyUp,
                        keydown: this.onKeyDown,
                        keypress: this.onKeyPress
        Severity: Major
        Found in app/assets/javascripts/ext/src/widgets/form/TextField.js and 2 other locations - About 40 mins to fix
        app/assets/javascripts/ext/src/widgets/menu/BaseItem.js on lines 93..98
        app/assets/javascripts/ext/src/widgets/menu/Menu.js on lines 221..226

        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 (value.length > this.maxLength) {
                    errors.push(String.format(this.maxLengthText, this.maxLength));
                }
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/form/TextField.js and 1 other location - About 35 mins to fix
        app/assets/javascripts/ext/src/widgets/form/TextField.js on lines 465..467

        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 (value.length < this.minLength) {
                    errors.push(String.format(this.minLengthText, this.minLength));
                }
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/form/TextField.js and 1 other location - About 35 mins to fix
        app/assets/javascripts/ext/src/widgets/form/TextField.js on lines 469..471

        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