CrazySquirrel/Utils

View on GitHub
lib/UtilsDOMVisibility.ts

Summary

Maintainability
C
1 day
Test Coverage

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 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

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

TODO found
Open

     * TODO: не учитывать родителей если position fixed
Severity: Minor
Found in lib/UtilsDOMVisibility.ts by fixme

There are no issues that match your filters.

Category
Status