modxcms/revolution

View on GitHub
manager/assets/modext/util/datetime.js

Summary

Maintainability
F
3 days
Test Coverage

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

/* Fix ExtJS 3.4 issue with new timezones */
Ext.override(Ext.form.TimeField, {
    initDate: '2/1/2008'
});

Severity: Minor
Found in manager/assets/modext/util/datetime.js - About 5 hrs to fix

    DateTime has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ext.ux.form.DateTime = Ext.extend(Ext.form.Field, {
        /**
         * @cfg {Function} dateValidator A custom validation function to be called during date field
         * validation (defaults to null)
         */
    Severity: Minor
    Found in manager/assets/modext/util/datetime.js - About 4 hrs to fix

      Function initComponent has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ,initComponent:function() {
              // call parent initComponent
              Ext.ux.form.DateTime.superclass.initComponent.call(this);
      
              // offset time
      Severity: Major
      Found in manager/assets/modext/util/datetime.js - About 2 hrs to fix

        Function setValue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            ,setValue:function(val) {
                if(!val && true === this.emptyToNow) {
                    this.setValue(new Date());
                    return;
                }
        Severity: Minor
        Found in manager/assets/modext/util/datetime.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 onRender has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ,onRender:function(ct, position) {
                // don't run more than once
                if(this.isRendered) {
                    return;
                }
        Severity: Minor
        Found in manager/assets/modext/util/datetime.js - About 1 hr to fix

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

              ,setValue:function(val) {
                  if(!val && true === this.emptyToNow) {
                      this.setValue(new Date());
                      return;
                  }
          Severity: Minor
          Found in manager/assets/modext/util/datetime.js - About 1 hr to fix

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

                ,updateDate:function() {
            
                    var d = this.df.getValue();
                    if(d) {
                        if(!(this.dateValue instanceof Date)) {
            Severity: Minor
            Found in manager/assets/modext/util/datetime.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

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

                ,setSize:function(w, h) {
                    if(!w) {
                        return;
                    }
                    if('below' === this.timePosition) {
            Severity: Minor
            Found in manager/assets/modext/util/datetime.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

            Function onRender has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                ,onRender:function(ct, position) {
                    // don't run more than once
                    if(this.isRendered) {
                        return;
                    }
            Severity: Minor
            Found in manager/assets/modext/util/datetime.js - About 25 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 onSpecialKey has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                ,onSpecialKey:function(t, e) {
                    var key = e.getKey();
                    if(key === e.TAB) {
                        if(t === this.df && !e.shiftKey) {
                            e.stopEvent();
            Severity: Minor
            Found in manager/assets/modext/util/datetime.js - About 25 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 updateTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                ,updateTime:function() {
                    var t = this.tf.getValue();
                    if(t && !(t instanceof Date)) {
                        t = Date.parseDate(t, this.tf.format);
                    }
            Severity: Minor
            Found in manager/assets/modext/util/datetime.js - About 25 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

                ,setDate:function(date) {
                    if (date && this.offset_time != 0) {
                        date = date.add(Date.MINUTE, 60 * new Number(this.offset_time));
                    }
                    this.df.setValue(date);
            Severity: Major
            Found in manager/assets/modext/util/datetime.js and 1 other location - About 2 hrs to fix
            manager/assets/modext/util/datetime.js on lines 488..493

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

            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

                ,setTime:function(date) {
                    if (date && this.offset_time != 0) {
                        date = date.add(Date.MINUTE, 60 * new Number(this.offset_time));
                    }
                    this.tf.setValue(date);
            Severity: Major
            Found in manager/assets/modext/util/datetime.js and 1 other location - About 2 hrs to fix
            manager/assets/modext/util/datetime.js on lines 477..482

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

            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

                ,validate:function() {
                    return this.df.validate() && this.tf.validate();
                } // eo function validate
            Severity: Minor
            Found in manager/assets/modext/util/datetime.js and 1 other location - About 40 mins to fix
            manager/assets/modext/util/datetime.js on lines 365..367

            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

                ,isValid:function() {
                    return this.df.isValid() && this.tf.isValid();
                } // eo function isValid
            Severity: Minor
            Found in manager/assets/modext/util/datetime.js and 1 other location - About 40 mins to fix
            manager/assets/modext/util/datetime.js on lines 678..680

            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

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

                        ,listeners:{
                              blur:{scope:this, fn:this.onBlur}
                             ,focus:{scope:this, fn:this.onFocus}
                        }
            Severity: Minor
            Found in manager/assets/modext/util/datetime.js and 1 other location - About 35 mins to fix
            manager/assets/modext/util/datetime.js on lines 132..135

            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

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

                        ,listeners:{
                              blur:{scope:this, fn:this.onBlur}
                             ,focus:{scope:this, fn:this.onFocus}
                        }
            Severity: Minor
            Found in manager/assets/modext/util/datetime.js and 1 other location - About 35 mins to fix
            manager/assets/modext/util/datetime.js on lines 106..109

            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