FezVrasta/popper.js

View on GitHub

Showing 205 of 319 total issues

Function FloatingPortal has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function FloatingPortal(props: FloatingPortalProps): JSX.Element {
  const {children, id, root = null, preserveTabOrder = true} = props;

  const portalNode = useFloatingPortalNode({id, root});
  const [focusManagerState, setFocusManagerState] =
Severity: Major
Found in packages/react/src/components/FloatingPortal.tsx - About 3 hrs to fix

Function closeOnPressOutside has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const closeOnPressOutside = useEffectEvent((event: MouseEvent) => {
    // Given developers can stop the propagation of the synthetic event,
    // we can only be confident with a positive value.
    const insideReactTree = insideReactTreeRef.current;
    insideReactTreeRef.current = false;
Severity: Major
Found in packages/react/src/hooks/useDismiss.ts - About 3 hrs to fix

Function useRole has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

export function useRole(
  context: FloatingRootContext,
  props: UseRoleProps = {},
): ElementProps {
  const {open, floatingId} = context;
Severity: Minor
Found in packages/react/src/hooks/useRole.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 fn has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async fn(state) {
    const {placement, rects, platform, elements} = state;

    const {apply = () => {}, ...detectOverflowOptions} = evaluate(
      options,
Severity: Major
Found in packages/core/src/middleware/size.ts - About 3 hrs to fix

Function arrow has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export const arrow = (
  options: ArrowOptions | Derivable<ArrowOptions>,
): Middleware => ({
  name: 'arrow',
  options,
Severity: Minor
Found in packages/core/src/middleware/arrow.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 computePosition has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export const computePosition: ComputePosition = async (
  reference,
  floating,
  config,
) => {
Severity: Minor
Found in packages/core/src/computePosition.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 applyAttributeToOthers has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function applyAttributeToOthers(
  uncorrectedAvoidElements: Element[],
  body: HTMLElement,
  ariaHidden: boolean,
  inert: boolean,
Severity: Major
Found in packages/react/src/utils/markOthers.ts - About 3 hrs to fix

File DropdownMenu.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  autoUpdate,
  flip,
  FloatingFocusManager,
  FloatingNode,
Severity: Minor
Found in website/lib/components/Home/DropdownMenu.js - About 3 hrs to fix

Function useTransitionStyles has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useTransitionStyles<RT extends ReferenceType = ReferenceType>(
  context: FloatingContext<RT>,
  props: UseTransitionStylesProps = {},
): {
  isMounted: boolean;
Severity: Major
Found in packages/react/src/hooks/useTransition.ts - About 2 hrs to fix

File composite.ts has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {stopEvent} from '@floating-ui/react/utils';
import {floor} from '@floating-ui/utils';

import type {Dimensions} from '../types';

Severity: Minor
Found in packages/react/src/utils/composite.ts - About 2 hrs to fix

Function useHover has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

export function useHover(
  context: FloatingRootContext,
  props: UseHoverProps = {},
): ElementProps {
  const {open, onOpenChange, dataRef, events, elements} = context;
Severity: Minor
Found in packages/react/src/hooks/useHover.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 autoUpdate has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function autoUpdate(
  reference: ReferenceElement,
  floating: FloatingElement,
  update: () => void,
  options: AutoUpdateOptions = {},
Severity: Major
Found in packages/dom/src/autoUpdate.ts - About 2 hrs to fix

Function TooltipContent has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function TooltipContent(props, propRef) {
    const {context: floatingContext, ...context} =
      useTooltipContext();
    const ref = useMergeRefs([
      context.refs.setFloating,
Severity: Major
Found in website/lib/components/Tooltip.js - About 2 hrs to fix

Function onKeyDown has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const onKeyDown = useEffectEvent((event: React.KeyboardEvent) => {
    function getMatchingIndex(
      list: Array<string | null>,
      orderedList: Array<string | null>,
      string: string,
Severity: Major
Found in packages/react/src/hooks/useTypeahead.ts - About 2 hrs to fix

Function useFloating has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export function useFloating<T extends ReferenceElement = ReferenceElement>(
  reference: Readonly<Ref<MaybeElement<T>>>,
  floating: Readonly<Ref<MaybeElement<FloatingElement>>>,
  options: UseFloatingOptions<T> = {},
): UseFloatingReturn {
Severity: Minor
Found in packages/vue/src/useFloating.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 observeMove has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function observeMove(element: Element, onMove: () => void) {
  let io: IntersectionObserver | null = null;
  let timeoutId: NodeJS.Timeout;

  const root = getDocumentElement(element);
Severity: Minor
Found in packages/dom/src/autoUpdate.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 autoPlacement has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export const autoPlacement = (
  options: AutoPlacementOptions | Derivable<AutoPlacementOptions> = {},
): Middleware => ({
  name: 'autoPlacement',
  options,
Severity: Minor
Found in packages/core/src/middleware/autoPlacement.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 useRole has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useRole(
  context: FloatingRootContext,
  props: UseRoleProps = {},
): ElementProps {
  const {open, floatingId} = context;
Severity: Major
Found in packages/react/src/hooks/useRole.ts - About 2 hrs to fix

Function FloatingOverlay has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const FloatingOverlay = React.forwardRef(function FloatingOverlay(
  props: React.ComponentPropsWithoutRef<'div'> & FloatingOverlayProps,
  ref: React.ForwardedRef<HTMLDivElement>,
) {
  const {lockScroll = false, ...rest} = props;
Severity: Major
Found in packages/react/src/components/FloatingOverlay.tsx - About 2 hrs to fix

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

export const Result13 = () => {
  const [show, setShow] = useState(false);
  const [arrowEl, setArrowEl] = useState(null);

  const {
Severity: Major
Found in website/lib/components/Tutorial.js - About 2 hrs to fix
Severity
Category
Status
Source
Language