Undev/redmine-stuff-to-do-plugin

View on GitHub
assets/javascripts/ui/ui.dialog.js

Summary

Maintainability
F
5 days
Test Coverage

File ui.dialog.js has 508 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * jQuery UI Dialog @VERSION
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
Severity: Major
Found in assets/javascripts/ui/ui.dialog.js - About 1 day to fix

    Function _init has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _init: function() {
            this.originalTitle = this.element.attr('title');
            this.options.title = this.options.title || this.originalTitle;
    
            var self = this,
    Severity: Major
    Found in assets/javascripts/ui/ui.dialog.js - About 4 hrs to fix

      Function _position has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _position: function(pos) {
              var wnd = $(window), doc = $(document),
                  pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
                  minTop = pTop;
      
      
      Severity: Minor
      Found in assets/javascripts/ui/ui.dialog.js - About 1 hr to fix

        Function create has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            create: function(dialog) {
                if (this.instances.length === 0) {
                    // prevent use of anchors and inputs
                    // we use a setTimeout in case the overlay is created from an
                    // event that we're going to be cancelling (see #2804)
        Severity: Minor
        Found in assets/javascripts/ui/ui.dialog.js - About 1 hr to fix

          Function _setData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _setData: function(key, value){
                  (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
                  switch (key) {
                      case "buttons":
                          this._createButtons(value);
          Severity: Minor
          Found in assets/javascripts/ui/ui.dialog.js - About 1 hr to fix

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

                _makeResizable: function(handles) {
                    handles = (handles === undefined ? this.options.resizable : handles);
                    var self = this,
                        options = this.options,
                        resizeHandles = typeof handles == 'string'
            Severity: Minor
            Found in assets/javascripts/ui/ui.dialog.js - About 1 hr to fix

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

                  open: function() {
                      if (this._isOpen) { return; }
              
                      this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
                      (this.uiDialog.next().length && this.uiDialog.appendTo('body'));
              Severity: Minor
              Found in assets/javascripts/ui/ui.dialog.js - About 1 hr to fix

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

                    width: function() {
                        // handle IE 6
                        if ($.browser.msie && $.browser.version < 7) {
                            var scrollWidth = Math.max(
                                document.documentElement.scrollWidth,
                Severity: Major
                Found in assets/javascripts/ui/ui.dialog.js and 1 other location - About 1 day to fix
                assets/javascripts/ui/ui.dialog.js on lines 542..569

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

                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

                    height: function() {
                        // handle IE 6
                        if ($.browser.msie && $.browser.version < 7) {
                            var scrollHeight = Math.max(
                                document.documentElement.scrollHeight,
                Severity: Major
                Found in assets/javascripts/ui/ui.dialog.js and 1 other location - About 1 day to fix
                assets/javascripts/ui/ui.dialog.js on lines 571..598

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

                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 (pos[0].constructor == Number) {
                            pLeft += pos[0];
                        } else {
                            switch (pos[0]) {
                                case 'left':
                Severity: Major
                Found in assets/javascripts/ui/ui.dialog.js and 1 other location - About 3 hrs to fix
                assets/javascripts/ui/ui.dialog.js on lines 359..373

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

                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 (pos[1].constructor == Number) {
                            pTop += pos[1];
                        } else {
                            switch (pos[1]) {
                                case 'top':
                Severity: Major
                Found in assets/javascripts/ui/ui.dialog.js and 1 other location - About 3 hrs to fix
                assets/javascripts/ui/ui.dialog.js on lines 344..358

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

                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