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';
Function move
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
move(pos) {
if (isUndefined(this.element.parentNode)) {
return;
}
- Read upRead up
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;
}
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) {
Function position
has 133 lines of code (exceeds 30 allowed). Consider refactoring. Open
position({ top, left, targetAttachment }) {
if (!this.options.constraints) {
return true;
}
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';
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) {
- Read upRead up
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;
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',
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;
- Read upRead up
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';
- Read upRead up
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;
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);
});
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';
- Read upRead up
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;
Function position
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
position({ manualOffset, manualTargetOffset }) {
const offsets = {
element: manualOffset,
target: manualTargetOffset
};
- Read upRead up
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 _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';
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';
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;
}
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;
- Read upRead up
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"