shipshapecode/tether

View on GitHub

Showing 28 of 67 total issues

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

import '../css/tether.scss';
import '../css/tether-theme-arrows.scss';
import '../css/tether-theme-arrows-dark.scss';
import '../css/tether-theme-basic.scss';
import Abutment from './abutment';
Severity: Major
Found in src/js/tether.js - About 1 day to fix

    Function move has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
    Open

      move(pos) {
        if (isUndefined(this.element.parentNode)) {
          return;
        }
    
    
    Severity: Minor
    Found in src/js/tether.js - About 1 day 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 move has 149 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

      move(pos) {
        if (isUndefined(this.element.parentNode)) {
          return;
        }
    
    
    Severity: Major
    Found in src/js/tether.js - About 5 hrs to fix

      Function position has 148 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

        position(flushChanges = true) {
          // flushChanges commits the changes immediately, leave true unless you are positioning multiple
          // tethers (in which case call Tether.Utils.flush yourself when you're done)
      
          if (!this.enabled) {
      Severity: Major
      Found in src/js/tether.js - About 5 hrs to fix

        Function position has 133 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

          position({ top, left, targetAttachment }) {
            if (!this.options.constraints) {
              return true;
            }
        
        
        Severity: Major
        Found in src/js/constraint.js - About 5 hrs to fix

          File constraint.js has 321 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { getClass, updateClasses } from './utils/classes';
          import { defer } from './utils/deferred';
          import { extend } from './utils/general';
          import { getBounds } from './utils/bounds';
          import { isString, isUndefined } from './utils/type-check';
          Severity: Minor
          Found in src/js/constraint.js - About 3 hrs to fix

            Function position has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              position(flushChanges = true) {
                // flushChanges commits the changes immediately, leave true unless you are positioning multiple
                // tethers (in which case call Tether.Utils.flush yourself when you're done)
            
                if (!this.enabled) {
            Severity: Minor
            Found in src/js/tether.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

            Function updateAttachClasses has 58 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

              updateAttachClasses(elementAttach, targetAttach) {
                elementAttach = elementAttach || this.attachment;
                targetAttach = targetAttach || this.targetAttachment;
                const sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
                const { classes, classPrefix } = this.options;
            Severity: Major
            Found in src/js/tether.js - About 2 hrs to fix

              Function setOptions has 54 lines of code (exceeds 30 allowed). Consider refactoring.
              Open

                setOptions(options, pos = true) {
                  const defaults = {
                    offset: '0 0',
                    targetOffset: '0 0',
                    targetAttachment: 'auto auto',
              Severity: Major
              Found in src/js/tether.js - About 1 hr to fix

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

                export function getScrollParents(el) {
                  // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
                  // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
                  const computedStyle = getComputedStyle(el) || {};
                  const { position } = computedStyle;
                Severity: Minor
                Found in src/js/utils/parents.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 _flipXTogether has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function _flipXTogether(tAttachment, eAttachment, bounds, width, targetWidth, left) {
                  if (left < bounds[0] && tAttachment.left === 'left') {
                    if (eAttachment.left === 'right') {
                      left += targetWidth;
                      tAttachment.left = 'right';
                Severity: Minor
                Found in src/js/constraint.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 getScrollHandleBounds has 43 lines of code (exceeds 30 allowed). Consider refactoring.
                Open

                export function getScrollHandleBounds(body, target) {
                  let bounds;
                  // We have to do the check for the scrollTop and if target === document.body here and set to variables
                  // because we may reset target below.
                  const targetScrollTop = target.scrollTop;
                Severity: Minor
                Found in src/js/utils/bounds.js - About 1 hr to fix

                  Function position has 42 lines of code (exceeds 30 allowed). Consider refactoring.
                  Open

                    position({ top, left }) {
                      const { height, width } = this.cache('element-bounds', () => {
                        return getBounds(this.element);
                      });
                  
                  
                  Severity: Minor
                  Found in src/js/abutment.js - About 1 hr to fix

                    Function _flipYTogether has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function _flipYTogether(tAttachment, eAttachment, bounds, height, targetHeight, top) {
                      if (tAttachment.top === 'top') {
                        if (eAttachment.top === 'bottom' && top < bounds[1]) {
                          top += targetHeight;
                          tAttachment.top = 'bottom';
                    Severity: Minor
                    Found in src/js/constraint.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 transcribe has 38 lines of code (exceeds 30 allowed). Consider refactoring.
                    Open

                        const transcribe = (_same, _pos) => {
                          const hasOptimizations = !isUndefined(this.options.optimizations);
                          const gpu = hasOptimizations ? this.options.optimizations.gpu : null;
                          if (gpu !== false) {
                            let yPos, xPos;
                    Severity: Minor
                    Found in src/js/tether.js - About 1 hr to fix

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

                        position({ manualOffset, manualTargetOffset }) {
                          const offsets = {
                            element: manualOffset,
                            target: manualTargetOffset
                          };
                      Severity: Minor
                      Found in src/js/tether.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 getBoundingRect has 34 lines of code (exceeds 30 allowed). Consider refactoring.
                      Open

                      function getBoundingRect(body, tether, to) {
                        // arg to is required
                        if (!to) {
                          return null;
                        }
                      Severity: Minor
                      Found in src/js/constraint.js - About 1 hr to fix

                        Function _flipYTogether has 34 lines of code (exceeds 30 allowed). Consider refactoring.
                        Open

                        function _flipYTogether(tAttachment, eAttachment, bounds, height, targetHeight, top) {
                          if (tAttachment.top === 'top') {
                            if (eAttachment.top === 'bottom' && top < bounds[1]) {
                              top += targetHeight;
                              tAttachment.top = 'bottom';
                        Severity: Minor
                        Found in src/js/constraint.js - About 1 hr to fix

                          Function _flipXTogether has 34 lines of code (exceeds 30 allowed). Consider refactoring.
                          Open

                          function _flipXTogether(tAttachment, eAttachment, bounds, width, targetWidth, left) {
                            if (left < bounds[0] && tAttachment.left === 'left') {
                              if (eAttachment.left === 'right') {
                                left += targetWidth;
                                tAttachment.left = 'right';
                          Severity: Minor
                          Found in src/js/constraint.js - About 1 hr to fix

                            Function updateAttachClasses has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              updateAttachClasses(elementAttach, targetAttach) {
                                elementAttach = elementAttach || this.attachment;
                                targetAttach = targetAttach || this.targetAttachment;
                                const sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
                                const { classes, classPrefix } = this.options;
                            Severity: Minor
                            Found in src/js/tether.js - About 45 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

                            Severity
                            Category
                            Status
                            Source
                            Language