FezVrasta/popper.js

View on GitHub

Showing 205 of 319 total issues

Function PopoverDemo has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function PopoverDemo() {
  const [isOpen, setIsOpen] = useState(false);
  const [name, setName] = useState('Balloon name');
  const [editName, setEditName] = useState(name);

Severity: Minor
Found in website/lib/components/Home/Popover.js - About 1 hr to fix

Function mergeProps has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mergeProps<Key extends keyof ElementProps>(
  userProps: (React.HTMLProps<Element> & ExtendedUserProps) | undefined,
  propsList: Array<ElementProps | void>,
  elementKey: Key,
): Record<string, unknown> {
Severity: Minor
Found in packages/react/src/hooks/useInteractions.ts - About 1 hr to fix

Function Flip has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Flip() {
  const [boundary, setBoundary] = useState();

  useEffect(() => {
    if (boundary) {
Severity: Minor
Found in website/lib/components/Home/PositioningDemos.js - About 1 hr to fix

Function getBoundingClientRect has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getBoundingClientRect() {
      const domRect = domElement?.getBoundingClientRect() || {
        width: 0,
        height: 0,
        x: 0,
Severity: Minor
Found in packages/react/src/hooks/useClientPoint.ts - About 1 hr to fix

Function useFloatingPortalNode has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useFloatingPortalNode(props: UseFloatingPortalNodeProps = {}) {
  const {id, root} = props;

  const uniqueId = useId();
  const portalContext = usePortalContext();
Severity: Minor
Found in packages/react/src/components/FloatingPortal.tsx - About 1 hr to fix

Function Arrow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Arrow() {
  const [boundary, setBoundary] = useState();

  return (
    <GridItem
Severity: Minor
Found in website/lib/components/Home/PositioningDemos.js - About 1 hr to fix

Function deepEqual has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function deepEqual(a: any, b: any) {
  if (a === b) {
    return true;
  }

Severity: Minor
Found in packages/react-native/src/utils/deepEqual.ts - About 1 hr to fix

Function deepEqual has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function deepEqual(a: any, b: any) {
  if (a === b) {
    return true;
  }

Severity: Minor
Found in packages/react-dom/src/utils/deepEqual.ts - About 1 hr to fix

Function refresh has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function refresh(skip = false, threshold = 1) {
    cleanup();

    const {left, top, width, height} = element.getBoundingClientRect();

Severity: Minor
Found in packages/dom/src/autoUpdate.ts - About 1 hr to fix

Function createController has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const createController = (defaultView: Window): Controller => {
  let selectedElement: HTMLElementWithMetadata | null = null;
  const observer = new MutationObserver((mutations) => {
    if (!selectedElement) {
      return;
Severity: Minor
Found in packages/devtools/src/controller.ts - About 1 hr to fix

Function FloatingDelayGroup has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function FloatingDelayGroup(
  props: FloatingDelayGroupProps,
): JSX.Element {
  const {children, delay, timeoutMs = 0} = props;

Severity: Minor
Found in packages/react/src/components/FloatingDelayGroup.tsx - About 1 hr to fix

Function useListItem has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useListItem(props: UseListItemProps = {}): {
  ref: (node: HTMLElement | null) => void;
  index: number;
} {
  const {label} = props;
Severity: Minor
Found in packages/react/src/components/FloatingList.tsx - About 1 hr to fix

Function PopoverContent has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function PopoverContent(props, propRef) {
    const {context: floatingContext, ...context} =
      usePopoverContext();
    const ref = useMergeRefs([
      context.refs.setFloating,
Severity: Minor
Found in website/lib/components/Popover.js - About 1 hr to fix

Function focusItem has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    (
      listRef: React.MutableRefObject<Array<HTMLElement | null>>,
      indexRef: React.MutableRefObject<number>,
      forceScrollIntoView = false,
    ) => {
Severity: Minor
Found in packages/react/src/hooks/useListNavigation.ts - About 1 hr to fix

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

export function useFloating(
  options: UseFloatingOptions = {},
): UseFloatingReturn {
  const {
    placement = 'bottom',
Severity: Minor
Found in packages/react-native/src/useFloating.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 ComboboxDemo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export function ComboboxDemo() {
  const [open, setOpen] = useState(false);
  const [inputValue, setInputValue] = useState('');
  const [activeIndex, setActiveIndex] = useState(null);
  const [padding, setPadding] = useState(25);
Severity: Minor
Found in website/lib/components/Home/Combobox.js - 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 getClippingElementAncestors has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function getClippingElementAncestors(
  element: Element,
  cache: PlatformWithCache['_c'],
): Array<Element> {
  const cachedResult = cache.get(element);
Severity: Minor
Found in packages/dom/src/platform/getClippingRect.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 autoUpdate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export function autoUpdate(
  reference: ReferenceElement,
  floating: FloatingElement,
  update: () => void,
  options: AutoUpdateOptions = {},
Severity: Minor
Found in packages/dom/src/autoUpdate.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 useDelayGroup has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useDelayGroup(
  context: FloatingRootContext,
  options: UseGroupOptions = {},
): GroupContext {
  const {open, onOpenChange, floatingId} = context;
Severity: Minor
Found in packages/react/src/components/FloatingDelayGroup.tsx - About 1 hr to fix

Function getClippingElementAncestors has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getClippingElementAncestors(
  element: Element,
  cache: PlatformWithCache['_c'],
): Array<Element> {
  const cachedResult = cache.get(element);
Severity: Minor
Found in packages/dom/src/platform/getClippingRect.ts - About 1 hr to fix
Severity
Category
Status
Source
Language