CrazySquirrel/Utils

View on GitHub

Showing 56 of 59 total issues

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

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

  public static clear(checkSupport: boolean = true): 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 getVersion has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  public static getVersion(): string {
    let os = System.getName();
    let osVersion: any = "";

    if (/Windows/.test(os)) {
Severity: Minor
Found in lib/UtilsSystem.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 isVisible has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static isVisible(domNode: HTMLElement,
                          booElement: boolean,
                          numDocumentWidth: number,
                          numDocumentHeight: number): boolean {
    /**
Severity: Minor
Found in lib/UtilsDOMVisibility.ts - About 1 hr to fix

Function checkTotalVisibility has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static checkTotalVisibility(domBanner: HTMLElement): number {
    /**
     * Устанавливаем флаг видимости элемента
     * Записываем элемент во временную переменную дял перебора по родителям
     * Устанавливаем флаг соответствия элемента исходному
Severity: Minor
Found in lib/UtilsDOMVisibility.ts - About 1 hr to fix

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,
Severity: Minor
Found in lib/UtilsDOM.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 easeInElastic has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  public static  easeInElastic(t: number, b: number, c: number, d: number): number {
    if (Easing.isValidParams(t, b, c, d)) {
      let s = 1.70158;
      let p = 0;
      let a = c;
Severity: Minor
Found in lib/UtilsAnimationEasing.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 easeOutElastic has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  public static easeOutElastic(t: number, b: number, c: number, d: number): number {
    if (Easing.isValidParams(t, b, c, d)) {
      let s = 1.70158;
      let p = 0;
      let a = c;
Severity: Minor
Found in lib/UtilsAnimationEasing.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 getVersion has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static getVersion(): string {
    let os = System.getName();
    let osVersion: any = "";

    if (/Windows/.test(os)) {
Severity: Minor
Found in lib/UtilsSystem.ts - About 1 hr to fix

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)) {
Severity: Minor
Found in lib/UtilsDOM.ts - About 1 hr to fix

Function getItem has 27 lines of code (exceeds 25 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

Function easeInOutElastic has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static  easeInOutElastic(t: number, b: number, c: number, d: number): number {
    if (Easing.isValidParams(t, b, c, d)) {
      let s = 1.70158;
      let p = 0;
      let a = c;
Severity: Minor
Found in lib/UtilsAnimationEasing.ts - About 1 hr to fix

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,
    };
Severity: Minor
Found in lib/UtilsDOM.ts - About 1 hr to fix

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,
    };
Severity: Minor
Found in lib/UtilsDOM.ts - About 55 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

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

  public static getName(): string {
    let browser;
    if (Browser.isOpera()) {
      browser = "Opera";
    } else if (Browser.isOperaNew()) {
Severity: Minor
Found in lib/UtilsBrowser.ts - 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

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

  public static getVersion(): string {
    let version;
    if (Browser.isOpera()) {
      version = Browser.getOperaVersion();
    } else if (Browser.isOperaNew()) {
Severity: Minor
Found in lib/UtilsBrowser.ts - 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

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

  public static easeInOutExpo(t: number, b: number, c: number, d: number): number {
    if (Easing.isValidParams(t, b, c, d)) {
      if (t === 0) {
        return b;
      }
Severity: Minor
Found in lib/UtilsAnimationEasing.ts - 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

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

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

Avoid deeply nested control flow statements.
Open

            if (typeof realObject[method] === "undefined") {

              realObject[method] = (...args) => {
                if (
                    typeof staticClass !== "undefined"
Severity: Major
Found in lib/UtilsMain.ts - About 45 mins to fix

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" &&
Severity: Minor
Found in lib/UtilsDOM.ts - 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