FezVrasta/popper.js

View on GitHub

Showing 329 of 329 total issues

Function handleFocusOutside has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function handleFocusOutside(event: FocusEvent) {
      const relatedTarget = event.relatedTarget as Element | null;

      queueMicrotask(() => {
        const movedToUnrelatedNode = !(
Severity: Minor
Found in packages/react/src/components/FloatingFocusManager.tsx - About 2 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                                        <Link
                                            ref={hash === url ? refs.setReference : null}
                                            href={url}
                                            className={cn(
                                                'text-md ml-4 block truncate rounded-tr-md rounded-br-md border-l border-gray-700 py-1 px-4',
Severity: Major
Found in website/lib/components/Layout.js and 1 other location - About 2 hrs to fix
website/lib/components/Layout.js on lines 440..451

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 75.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                        <Link
                            ref={hash === url ? refs.setReference : null}
                            href={url}
                            className={cn('block w-full truncate rounded-lg py-1 px-4', {
                                'font-bold hover:bg-gray-100 dark:hover:bg-purple-300/10':
Severity: Major
Found in website/lib/components/Layout.js and 1 other location - About 2 hrs to fix
website/lib/components/Layout.js on lines 460..474

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 75.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          <p className="dark:text-gray-400">
            Floating shapes in the header are licensed under CC
            BY from{' '}
            <a
              className="font-semibold text-rose-600 dark:text-rose-300"
Severity: Major
Found in website/pages/index.js and 1 other location - About 1 hr to fix
website/lib/components/Layout.js on lines 904..919

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 74.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                <p className="mt-4 text-sm">
                    Icons made by{' '}
                    <a
                        className="text-blue-600 dark:text-blue-400 underline"
                        href="https://www.zwicon.com/cheatsheet.html"
Severity: Major
Found in website/lib/components/Layout.js and 1 other location - About 1 hr to fix
website/pages/index.js on lines 644..661

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 74.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function getBoundingClientRect has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export function getBoundingClientRect(
  element: Element | VirtualElement,
  includeScale = false,
  isFixedStrategy = false,
  offsetParent?: Element | Window,
Severity: Minor
Found in packages/dom/src/utils/getBoundingClientRect.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 FloatingFocusManager has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export function FloatingFocusManager(
  props: FloatingFocusManagerProps,
): React.JSX.Element {
  const {
    context,
Severity: Minor
Found in packages/react/src/components/FloatingFocusManager.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 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 useFloatingPortalNode has 47 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

function isCrossOrientationCloseKey(
  key: string,
  orientation: UseListNavigationProps['orientation'],
  rtl: boolean,
) {
Severity: Major
Found in packages/react/src/hooks/useListNavigation.ts and 1 other location - About 1 hr to fix
packages/react/src/hooks/useListNavigation.ts on lines 84..92

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

function isCrossOrientationOpenKey(
  key: string,
  orientation: UseListNavigationProps['orientation'],
  rtl: boolean,
) {
Severity: Major
Found in packages/react/src/hooks/useListNavigation.ts and 1 other location - About 1 hr to fix
packages/react/src/hooks/useListNavigation.ts on lines 94..102

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 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 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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

                '[data-chars-id="c"]': {
                  backgroundColor: theme.colors.purple[800],
                  color: `${theme.colors.purple[200]} !important`,
                  borderBottomColor: theme.colors.purple[500],
                  boxShadow: 'none',
Severity: Major
Found in website/tailwind.config.js and 5 other locations - About 1 hr to fix
website/tailwind.config.js on lines 232..237
website/tailwind.config.js on lines 238..243
website/tailwind.config.js on lines 244..249
website/tailwind.config.js on lines 259..264
website/tailwind.config.js on lines 265..270

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

              '[data-chars-id="a"]': {
                backgroundColor: theme.colors.rose[100],
                color: `${theme.colors.rose[900]} !important`,
                borderBottomColor: theme.colors.rose[300],
                boxShadow: 'none',
Severity: Major
Found in website/tailwind.config.js and 5 other locations - About 1 hr to fix
website/tailwind.config.js on lines 238..243
website/tailwind.config.js on lines 244..249
website/tailwind.config.js on lines 259..264
website/tailwind.config.js on lines 265..270
website/tailwind.config.js on lines 271..276

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

                '[data-chars-id="a"]': {
                  backgroundColor: theme.colors.rose[800],
                  color: `${theme.colors.rose[200]} !important`,
                  borderBottomColor: theme.colors.rose[500],
                  boxShadow: 'none',
Severity: Major
Found in website/tailwind.config.js and 5 other locations - About 1 hr to fix
website/tailwind.config.js on lines 232..237
website/tailwind.config.js on lines 238..243
website/tailwind.config.js on lines 244..249
website/tailwind.config.js on lines 265..270
website/tailwind.config.js on lines 271..276

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

              '[data-chars-id="b"]': {
                backgroundColor: theme.colors.cyan[100],
                color: `${theme.colors.cyan[900]} !important`,
                borderBottomColor: theme.colors.cyan[300],
                boxShadow: 'none',
Severity: Major
Found in website/tailwind.config.js and 5 other locations - About 1 hr to fix
website/tailwind.config.js on lines 232..237
website/tailwind.config.js on lines 244..249
website/tailwind.config.js on lines 259..264
website/tailwind.config.js on lines 265..270
website/tailwind.config.js on lines 271..276

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language