FezVrasta/popper.js

View on GitHub

Showing 205 of 319 total issues

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

export const serialize = <Data extends object>(
  data: Data,
  references: References,
): Serialized<Data> => {
  const serializedData: Serialized<Data> = JSON.parse(
Severity: Minor
Found in packages/devtools/src/utils/serialize.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 (runs < 2) {
                const scheduler = runs ? requestAnimationFrame : queueMicrotask;
                scheduler(waitForListPopulated);
              }
Severity: Major
Found in packages/react/src/hooks/useListNavigation.ts - About 45 mins to fix

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

export const Chrome = ({
  children,
  center,
  scrollable = 'none',
  relative = true,
Severity: Minor
Found in website/lib/components/Chrome.js - 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 computeCoordsFromPlacement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function computeCoordsFromPlacement(
  {reference, floating}: ElementRects,
  placement: Placement,
  rtl?: boolean,
): Coords {
Severity: Minor
Found in packages/core/src/computeCoordsFromPlacement.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 detectOverflow has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export async function detectOverflow(
  state: MiddlewareState,
  options: DetectOverflowOptions | Derivable<DetectOverflowOptions> = {},
): Promise<SideObject> {
  const {x, y, platform, rects, elements, strategy} = state;
Severity: Minor
Found in packages/core/src/detectOverflow.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

Consider simplifying this complex logical expression.
Open

  if (
    path.includes('react') ||
    path.includes('use') ||
    path.includes('floating') ||
    path.includes('composite') ||
Severity: Major
Found in website/lib/utils/getPackageContext.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if (
      listContent == null ||
      ignoreKeysRef.current.includes(event.key) ||
      // Character key.
      event.key.length !== 1 ||
Severity: Major
Found in packages/react/src/hooks/useTypeahead.ts - About 40 mins to fix

Function getCellIndexOfCorner has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  index: number,
  sizes: Dimensions[],
  cellMap: (number | undefined)[],
  cols: number,
  corner: 'tl' | 'tr' | 'bl' | 'br',
Severity: Minor
Found in packages/react/src/utils/composite.ts - About 35 mins to fix

Function useFloatingRootContext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function useFloatingRootContext(
  options: UseFloatingRootContextOptions,
): FloatingRootContext {
  const {
    open = false,
Severity: Minor
Found in packages/react/src/hooks/useFloatingRootContext.ts - About 35 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 getScale has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function getScale(element: Element | VirtualElement): Coords {
  const domElement = unwrapElement(element);

  if (!isHTMLElement(domElement)) {
    return createCoords(1);
Severity: Minor
Found in packages/dom/src/platform/getScale.ts - About 35 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 NavbarItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function NavbarItem({
    url,
    title,
    icon: Icon,
    hide,
Severity: Minor
Found in website/lib/components/Layout.js - About 35 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 too many return statements within this function.
Open

          return false;
Severity: Major
Found in packages/react-dom/src/utils/deepEqual.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return;
Severity: Major
Found in packages/react/src/safePolygon.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return false;
Severity: Major
Found in packages/react-native/src/utils/deepEqual.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return false;
Severity: Major
Found in packages/react-native/src/utils/deepEqual.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return;
Severity: Major
Found in packages/react/src/safePolygon.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return close();
Severity: Major
Found in packages/react/src/safePolygon.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return a !== a && b !== b;
Severity: Major
Found in packages/react-native/src/utils/deepEqual.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return true;
Severity: Major
Found in packages/react-native/src/utils/deepEqual.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return false;
Severity: Major
Found in packages/react-dom/src/utils/deepEqual.ts - About 30 mins to fix
Severity
Category
Status
Source
Language