datahuborg/datahub

View on GitHub
src/browser/static/dbwipes/js/lib/tether.js

Summary

Maintainability
F
3 mos
Test Coverage

File tether.js has 1363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! tether 0.6.5 */


(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
Severity: Major
Found in src/browser/static/dbwipes/js/lib/tether.js - About 3 days to fix

    Function position has 259 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        position: function(_arg) {
          var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
            _this = this;
          top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
          if (!this.options.constraints) {
    Severity: Major
    Found in src/browser/static/dbwipes/js/lib/tether.js - About 1 day to fix

      Function position has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _Tether.prototype.position = function(flushChanges) {
            var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6,
              _this = this;
            if (flushChanges == null) {
              flushChanges = true;
      Severity: Major
      Found in src/browser/static/dbwipes/js/lib/tether.js - About 5 hrs to fix

        Function move has 113 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _Tether.prototype.move = function(position) {
              var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
                _this = this;
              if (this.element.parentNode == null) {
                return;
        Severity: Major
        Found in src/browser/static/dbwipes/js/lib/tether.js - About 4 hrs to fix

          Function getTargetBounds has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _Tether.prototype.getTargetBounds = function() {
                var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
                if (this.targetModifier != null) {
                  switch (this.targetModifier) {
                    case 'visible':
          Severity: Major
          Found in src/browser/static/dbwipes/js/lib/tether.js - About 3 hrs to fix

            Function setOptions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _Tether.prototype.setOptions = function(options, position) {
                  var defaults, key, _i, _len, _ref1, _ref2;
                  this.options = options;
                  if (position == null) {
                    position = true;
            Severity: Major
            Found in src/browser/static/dbwipes/js/lib/tether.js - About 2 hrs to fix

              Function position has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  position: function(_arg) {
                    var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
                      _this = this;
                    top = _arg.top, left = _arg.left;
                    _ref1 = this.cache('element-bounds', function() {
              Severity: Minor
              Found in src/browser/static/dbwipes/js/lib/tether.js - About 1 hr to fix

                Function updateAttachClasses has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
                      var add, all, side, sides, _i, _j, _len, _len1, _ref1,
                        _this = this;
                      if (elementAttach == null) {
                        elementAttach = this.attachment;
                Severity: Minor
                Found in src/browser/static/dbwipes/js/lib/tether.js - About 1 hr to fix

                  Function position has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      position: function(_arg) {
                        var left, result, shift, shiftLeft, shiftTop, top, _ref;
                        top = _arg.top, left = _arg.left;
                        if (!this.options.shift) {
                          return;
                  Severity: Minor
                  Found in src/browser/static/dbwipes/js/lib/tether.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                if (eAttachment.left === 'left') {
                                  left -= targetWidth;
                                  tAttachment.left = 'left';
                                  left -= width;
                                  eAttachment.left = 'right';
                    Severity: Major
                    Found in src/browser/static/dbwipes/js/lib/tether.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                } else if (tAttachment.left === 'center') {
                                  if (left + width > bounds[2] && eAttachment.left === 'left') {
                                    left -= width;
                                    eAttachment.left = 'right';
                                  } else if (left < bounds[0] && eAttachment.left === 'right') {
                      Severity: Major
                      Found in src/browser/static/dbwipes/js/lib/tether.js - About 45 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                                if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
                                  elVal = parseFloat(elVal);
                                  val = parseFloat(val);
                                }
                        Severity: Major
                        Found in src/browser/static/dbwipes/js/lib/tether.js - About 40 mins to fix

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

                          (function(root, factory) {
                            if (typeof define === 'function' && define.amd) {
                              define(factory);
                            } else if (typeof exports === 'object') {
                              module.exports = factory(require,exports,module);
                          Severity: Major
                          Found in src/browser/static/dbwipes/js/lib/tether.js and 1 other location - About 3 mos to fix
                          src/apps/dbwipes/static/js/lib/tether.js on lines 4..1445

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

                          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