ianheggie/cruisecontrol.rb

View on GitHub
public/javascripts/jquery-ui/development-bundle/ui/jquery.ui.draggable.js

Summary

Maintainability
F
2 mos
Test Coverage

File jquery.ui.draggable.js has 588 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery UI Draggable 1.8.21
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.

    Consider simplifying this complex logical expression.
    Open

                if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
                    if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
                    inst.snapElements[i].snapping = false;
                    continue;
                }
    Severity: Critical
    Found in public/javascripts/jquery-ui/development-bundle/ui/jquery.ui.draggable.js - About 4 hrs to fix

      Consider simplifying this complex logical expression.
      Open

              if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
                      var c = $(o.containment);
                  var ce = c[0]; if(!ce) return;
                  var co = c.offset();
                  var over = ($(ce).css("overflow") != 'hidden');
      Severity: Critical
      Found in public/javascripts/jquery-ui/development-bundle/ui/jquery.ui.draggable.js - About 2 hrs to fix

        Function drag has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            drag: function(event, ui) {
        
                var inst = $(this).data("draggable"), self = this;
        
                var checkPos = function(o) {

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

              _generatePosition: function(event) {
          
                  var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
                  var pageX = event.pageX;
                  var pageY = event.pageY;

            Function _mouseStart has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _mouseStart: function(event) {
            
                    var o = this.options;
            
                    //Create and append the visible helper

              Function drag has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  drag: function(event, ui) {
              
                      var inst = $(this).data("draggable"), o = inst.options;
                      var d = o.snapTolerance;
              
              

                Function drag has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    drag: function(event, ui) {
                
                        var i = $(this).data("draggable"), o = i.options, scrolled = false;
                
                        if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {

                  Function _mouseStop has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _mouseStop: function(event) {
                  
                          //If we are using droppables, inform the manager about the drop
                          var dropped = false;
                          if ($.ui.ddmanager && !this.options.dropBehaviour)

                    Consider simplifying this complex logical expression.
                    Open

                            if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
                                var self = this;
                                $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
                                    if(self._trigger("stop", event) !== false) {
                                        self._clear();

                      Consider simplifying this complex logical expression.
                      Open

                                  if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
                                      (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));

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

                        (function( $, undefined ) {
                        
                        $.widget("ui.draggable", $.ui.mouse, {
                            widgetEventPrefix: "drag",
                            options: {
                        public/javascripts/jquery-ui/development-bundle/ui/jquery-ui-1.8.21.custom.js on lines 1074..1892

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

                        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