FezVrasta/popper.js

View on GitHub

Showing 205 of 319 total issues

Function useTransitionStatus has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useTransitionStatus(
  context: FloatingContext,
  props: UseTransitionStatusProps = {},
): {
  isMounted: boolean;
Severity: Minor
Found in packages/react/src/hooks/useTransition.ts - About 1 hr to fix

Function closeOnEscapeKeyDown has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    (event: React.KeyboardEvent<Element> | KeyboardEvent) => {
      if (!open || !enabled || !escapeKey || event.key !== 'Escape') {
        return;
      }

Severity: Minor
Found in packages/react/src/hooks/useDismiss.ts - About 1 hr to fix

Function onMeasure has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      const onMeasure = (offsetX = 0, offsetY = 0) => {
        floating.measure(
          (x: number, y: number, width: number, height: number) => {
            const floatingRect = {width, height, ...ORIGIN};
            const method = sameScrollView ? 'measure' : 'measureInWindow';
Severity: Minor
Found in packages/react-native/src/createPlatform.ts - About 1 hr to fix

Function deep has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function deep(parent: Element | null) {
    if (!parent || elementsToStop.has(parent)) {
      return;
    }

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

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

export const arrow = (
  options: ArrowOptions | Derivable<ArrowOptions>,
): Middleware => {
  function isRef(value: unknown): value is React.MutableRefObject<unknown> {
    return {}.hasOwnProperty.call(value, 'current');
Severity: Minor
Found in packages/react-dom/src/arrow.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 Link has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const Link = forwardRef(function Link(props, ref) {
  const {setPageTransitionStatus, setArticleTransitionStatus} =
    useAppContext();
  const router = useRouter();

Severity: Minor
Found in website/lib/components/Link.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 arrow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const arrow = (
  options: ArrowOptions | Derivable<ArrowOptions>,
): Middleware => {
  function isRef(value: unknown) {
    return {}.hasOwnProperty.call(value, 'current');
Severity: Minor
Found in packages/react-native/src/arrow.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 _extends has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function _extends() {
  const _extends =
    Object.assign ||
    function (target) {
      for (var i = 1; i < arguments.length; i++) {
Severity: Minor
Found in website/lib/components/ReachSkipNav.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 useListItem has a Cognitive Complexity of 10 (exceeds 5 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

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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function applyAttributeToOthers(
  uncorrectedAvoidElements: Element[],
  body: HTMLElement,
  ariaHidden: boolean,
  inert: boolean,
Severity: Minor
Found in packages/react/src/utils/markOthers.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 generateBase64Images has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function generateBase64Images() {
  try {
    const files = await fs.readdir(publicPath);
    const imageFiles = files.filter((file) => {
      const extension = path.extname(file).toLowerCase();
Severity: Minor
Found in website/b64.js - About 1 hr to fix

Function reference has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const reference: ElementProps['reference'] = React.useMemo(() => {
    function setPointerRef(event: React.PointerEvent) {
      pointerTypeRef.current = event.pointerType;
    }

Severity: Minor
Found in packages/react/src/hooks/useHover.ts - About 1 hr to fix

Function onBlur has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      onBlur(event) {
        blockFocusRef.current = false;
        const relatedTarget = event.relatedTarget;
        const nativeEvent = event.nativeEvent;

Severity: Minor
Found in packages/react/src/hooks/useFocus.ts - About 1 hr to fix

Function a has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    a(props) {
        const className =
            'transition-colors inline-flex items-center border-none underline ' +
            'underline-offset-4 text-rose-600 dark:text-rose-300 hover:text-gray-1000 dark:hover:text-gray-50 ' +
            'decoration-rose-500/80 dark:decoration-rose-300/70 ' +
Severity: Minor
Found in website/lib/components/Layout.js - About 1 hr to fix

Function getDocumentRect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getDocumentRect(element: HTMLElement): Rect {
  const html = getDocumentElement(element);
  const scroll = getNodeScroll(element);
  const body = element.ownerDocument.body;

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

Function fn has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  fn: (state: MiddlewareState) => {
    const {[ELEMENT_METADATA]: metadata} = isHTMLElementWithMetadata(
      state.elements.floating,
    )
      ? state.elements.floating
Severity: Minor
Found in packages/devtools/src/middleware.ts - About 1 hr to fix

Function Menu has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const MenuComponent = forwardRef(function Menu(
  {children, label, ...props},
  forwardedRef,
) {
  const [isOpen, setIsOpen] = useState(false);
Severity: Minor
Found in website/lib/components/Home/DropdownMenu.js - About 55 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 getRectRelativeToOffsetParent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function getRectRelativeToOffsetParent(
  element: Element | VirtualElement,
  offsetParent: Element | Window,
  strategy: Strategy,
): Rect {
Severity: Minor
Found in packages/dom/src/utils/getRectRelativeToOffsetParent.ts - About 55 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 getOverflowAncestors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function getOverflowAncestors(
  node: Node,
  list: OverflowAncestors = [],
  traverseIframes = true,
): OverflowAncestors {
Severity: Minor
Found in packages/utils/src/dom.ts - About 55 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 isContainingBlock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function isContainingBlock(element: Element): boolean {
  const webkit = isWebKit();
  const css = getComputedStyle(element);

  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
Severity: Minor
Found in packages/utils/src/dom.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

Severity
Category
Status
Source
Language