File UtilsDOM.ts
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
/**
* Import additional classes
*/
import UtilsMain from "./UtilsMain";
- Create a ticketCreate a ticket
Function getBoundingClientRect
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static getBoundingClientRect(domNode: any, domDocument: Document = document, showForce: boolean = false): {
bottom: number,
height: number,
left: number,
right: number,
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (
!domNode ||
domNode.nodeType !== 1 || !domNode.parentNode ||
domNode.parentNode.nodeName === "HTML" ||
(
- Create a ticketCreate a ticket
Function getBoundingClientRect
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static getBoundingClientRect(domNode: any, domDocument: Document = document, showForce: boolean = false): {
bottom: number,
height: number,
left: number,
right: number,
- Read upRead up
- Create a ticketCreate a ticket
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 getDOMNode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static getDOMNode(domNode: any, domDocument: Document = document): Element | boolean {
/**
* Check if domDocument is a valid variable
*/
if (!DOM.isDOMDocument(domDocument)) {
- Create a ticketCreate a ticket
Function findElementPosition
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static findElementPosition(domNode: any, domDocument: Document = document, showForce: boolean = false) {
const objRet = {
left: 0,
top: 0,
};
- Create a ticketCreate a ticket
Function findElementPosition
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static findElementPosition(domNode: any, domDocument: Document = document, showForce: boolean = false) {
const objRet = {
left: 0,
top: 0,
};
- Read upRead up
- Create a ticketCreate a ticket
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 removeClassName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static removeClassName(element: HTMLElement, className: string): HTMLElement {
if (
element &&
typeof element === "object" &&
typeof className === "string" &&
- Read upRead up
- Create a ticketCreate a ticket
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 getDOMNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static getDOMNode(domNode: any, domDocument: Document = document): Element | boolean {
/**
* Check if domDocument is a valid variable
*/
if (!DOM.isDOMDocument(domDocument)) {
- Read upRead up
- Create a ticketCreate a ticket
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 addClassName
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static addClassName(element: HTMLElement, className: string): HTMLElement {
if (
element &&
typeof element === "object" &&
typeof className === "string" &&
- Read upRead up
- Create a ticketCreate a ticket
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 toggleClassName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static toggleClassName(element: HTMLElement, className: string, toggle: boolean): HTMLElement {
if (
element &&
typeof element === "object" &&
typeof className === "string" &&
- Read upRead up
- Create a ticketCreate a ticket
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"