FezVrasta/popper.js

View on GitHub

Showing 208 of 322 total issues

File PackageSelect.js has 440 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  Composite,
  CompositeItem,
  FloatingArrow,
  FloatingFocusManager,
Severity: Minor
Found in website/lib/components/PackageSelect.js - About 6 hrs to fix

Function commonOnKeyDown has 162 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const commonOnKeyDown = useEffectEvent((event: React.KeyboardEvent) => {
    isPointerModalityRef.current = false;
    forceSyncFocus.current = true;

    // If the floating element is animating out, ignore navigation. Otherwise,
Severity: Major
Found in packages/react/src/hooks/useListNavigation.ts - About 6 hrs to fix

Function useFocus has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

export function useFocus(
  context: FloatingRootContext,
  props: UseFocusProps = {},
): ElementProps {
  const {open, onOpenChange, events, dataRef, elements} = context;
Severity: Minor
Found in packages/react/src/hooks/useFocus.ts - About 6 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 useTypeahead has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

export function useTypeahead(
  context: FloatingRootContext,
  props: UseTypeaheadProps,
): ElementProps {
  const {open, dataRef} = context;
Severity: Minor
Found in packages/react/src/hooks/useTypeahead.ts - About 6 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 getPolygon has 150 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      function getPolygon([x, y]: Point): Array<Point> {
        switch (side) {
          case 'top': {
            const cursorPointOne: Point = [
              isFloatingWider
Severity: Major
Found in packages/react/src/safePolygon.ts - About 6 hrs to fix

Function useFloating has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useFloating<RT extends ReferenceType = ReferenceType>(
  options: UseFloatingOptions = {},
): UseFloatingReturn<RT> {
  const {
    placement = 'bottom',
Severity: Major
Found in packages/react-dom/src/useFloating.ts - About 5 hrs to fix

Function flip has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

export const flip = (
  options: FlipOptions | Derivable<FlipOptions> = {},
): Middleware => ({
  name: 'flip',
  options,
Severity: Minor
Found in packages/core/src/middleware/flip.ts - About 5 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 useFloating has 147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useFloating(
  options: UseFloatingOptions = {},
): UseFloatingReturn {
  const {
    placement = 'bottom',
Severity: Major
Found in packages/react-native/src/useFloating.ts - About 5 hrs to fix

Function ComboboxDemo has 145 lines of code (exceeds 25 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: Major
Found in website/lib/components/Home/Combobox.js - About 5 hrs to fix

Function Placement has 144 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Placement() {
  const [placement, setPlacement] = useState('top');

  return (
    <GridItem
Severity: Major
Found in website/lib/components/Home/PositioningDemos.js - About 5 hrs to fix

Function SelectDemo has 141 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function SelectDemo() {
  const [isOpen, setIsOpen] = useState(false);
  const [activeIndex, setActiveIndex] = useState(null);
  const [selectedIndex, setSelectedIndex] = useState(null);

Severity: Major
Found in website/lib/components/Home/Select.js - About 5 hrs to fix

Function useTypeahead has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

File tailwind.config.js has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const colors = require('tailwindcss/colors');
const {fontFamily} = require('tailwindcss/defaultTheme');

const GRAY = {
  ...colors.gray,
Severity: Minor
Found in website/tailwind.config.js - About 5 hrs to fix

Function size has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

export const size = (
  options: SizeOptions | Derivable<SizeOptions> = {},
): Middleware => ({
  name: 'size',
  options,
Severity: Minor
Found in packages/core/src/middleware/size.ts - About 5 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 deepEqual has a Cognitive Complexity of 35 (exceeds 5 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 5 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 deepEqual has a Cognitive Complexity of 35 (exceeds 5 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 5 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 reference has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const reference: ElementProps['reference'] = React.useMemo(() => {
    function checkVirtualMouse(event: React.PointerEvent) {
      if (focusItemOnOpen === 'auto' && isVirtualClick(event.nativeEvent)) {
        focusItemOnOpenRef.current = true;
      }
Severity: Major
Found in packages/react/src/hooks/useListNavigation.ts - About 5 hrs to fix

File useHover.ts has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  contains,
  getDocument,
  isMouseLikePointerType,
} from '@floating-ui/react/utils';
Severity: Minor
Found in packages/react/src/hooks/useHover.ts - About 4 hrs to fix

Function Canvas has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Canvas() {
  const canvasRef = useRef(null);
  const [width, setWidth] = useState(null);
  const [height, setHeight] = useState(null);

Severity: Major
Found in website/lib/components/Canvas.js - About 4 hrs to fix

Function handleKeyDown has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function handleKeyDown(event: React.KeyboardEvent<HTMLElement>) {
    if (!allKeys.includes(event.key)) return;

    let nextIndex = activeIndex;
    const minIndex = getMinIndex(elementsRef, disabledIndices);
Severity: Major
Found in packages/react/src/components/Composite.tsx - About 4 hrs to fix
Severity
Category
Status
Source
Language