CrazySquirrel/Utils

View on GitHub

Showing 59 of 59 total issues

Function getName has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static getName(): string {
    let os = "";
    const clientStrings = [
      {
        r: /(Windows 10.0|Windows NT 10.0)/,
Severity: Major
Found in lib/UtilsSystem.ts - About 4 hrs to fix

Function setItem has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  public static setItem(checkSupport: boolean = true,
                        key: string,
                        value: string,
                        expires: number = 30,
                        path: string = "/",
Severity: Minor
Found in lib/UtilsCookie.ts - About 4 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

File UtilsAnimationEasing.ts has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
/**
 * Different time animation functions
 */
export default class Easing {
Severity: Minor
Found in lib/UtilsAnimationEasing.ts - About 4 hrs to fix

Easing has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Easing {
  public static def = "easeOutQuad";

  public static isValidParams(t: number, b: number, c: number, d: number, s?: number): boolean {
    return (
Severity: Minor
Found in lib/UtilsAnimationEasing.ts - About 4 hrs to fix

Function implementationStaticMethods has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  public static implementationStaticMethods(realObject: any, className?: string): void {
    if (
        !!realObject &&
        typeof realObject === "object"
    ) {
Severity: Minor
Found in lib/UtilsMain.ts - About 3 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 getWheelDelta has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  public static getWheelDelta(e): number {
    if (
        e &&
        typeof e === "object" &&
        (
Severity: Minor
Found in lib/UtilsMouse.ts - About 3 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

Browser has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Browser {
  /**
   * Get browser info
   * @return {{browser: string, mobile: boolean, version: string}}
   */
Severity: Minor
Found in lib/UtilsBrowser.ts - About 3 hrs to fix

Consider simplifying this complex logical expression.
Open

      if (
          typeof checkSupport === "boolean" &&
          (
              typeof key === "string" &&
              Cookie.regValidKey.test(key)
Severity: Critical
Found in lib/UtilsCookie.ts - About 3 hrs to fix

File UtilsDOM.ts has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
/**
 * Import additional classes
 */
import UtilsMain from "./UtilsMain";
Severity: Minor
Found in lib/UtilsDOM.ts - About 2 hrs to fix

Function stack has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static stack(): any[] {
    const e: IError = new Error();
    return (
            e &&
            e.stack &&
Severity: Major
Found in lib/UtilsMain.ts - About 2 hrs to fix

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,
Severity: Major
Found in lib/UtilsDOM.ts - About 2 hrs to fix

Function setItem has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static setItem(checkSupport: boolean = true,
                        key: string,
                        value: string,
                        expires: number = 30,
                        path: string = "/",
Severity: Major
Found in lib/UtilsCookie.ts - About 2 hrs to fix

Function isVisible has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  public static isVisible(domNode: HTMLElement,
                          booElement: boolean,
                          numDocumentWidth: number,
                          numDocumentHeight: number): boolean {
    /**
Severity: Minor
Found in lib/UtilsDOMVisibility.ts - 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 getWheelDelta has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static getWheelDelta(e): number {
    if (
        e &&
        typeof e === "object" &&
        (
Severity: Major
Found in lib/UtilsMouse.ts - About 2 hrs to fix

Consider simplifying this complex logical expression.
Open

    if (
        e &&
        typeof e === "object" &&
        (
            "detail" in e ||
Severity: Critical
Found in lib/UtilsMouse.ts - About 2 hrs to fix

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

  public static getItem(checkSupport: boolean = true,
                        key: string): string|boolean {
    try {
      /**
       * Validate input data
Severity: Minor
Found in lib/UtilsCookie.ts - 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 checkTotalVisibility has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  public static checkTotalVisibility(domBanner: HTMLElement): number {
    /**
     * Устанавливаем флаг видимости элемента
     * Записываем элемент во временную переменную дял перебора по родителям
     * Устанавливаем флаг соответствия элемента исходному
Severity: Minor
Found in lib/UtilsDOMVisibility.ts - 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 calcVisibility has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  public static calcVisibility(objSizes: {
    left: number,
    right: number,
    top: number,
    bottom: number,
Severity: Minor
Found in lib/UtilsDOMVisibility.ts - 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

Consider simplifying this complex logical expression.
Open

    if (
        !domNode ||
        domNode.nodeType !== 1 || !domNode.parentNode ||
        domNode.parentNode.nodeName === "HTML" ||
        (
Severity: Critical
Found in lib/UtilsDOM.ts - About 1 hr to fix

Function getKeys has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  public static getKeys(checkSupport: boolean = true): string[] {
    try {
      /**
       * Validate input data
       */
Severity: Minor
Found in lib/UtilsCookie.ts - 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

Severity
Category
Status
Source
Language