Showing 329 of 329 total issues
Function detectOverflow
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function detectOverflow(
state: MiddlewareState,
options: DetectOverflowOptions | Derivable<DetectOverflowOptions> = {},
): Promise<SideObject> {
const {x, y, platform, rects, elements, strategy} = state;
- Create a ticketCreate a ticket
Function fn
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
async fn(state) {
const {x, y, placement, rects, platform, elements, middlewareData} = state;
// Since `element` is required, we don't Partial<> the type.
const {element, padding = 0} = evaluate(options, state) || {};
- Create a ticketCreate a ticket
Function observeMove
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function observeMove(element: Element, onMove: () => void) {
let io: IntersectionObserver | null = null;
let timeoutId: NodeJS.Timeout;
const root = getDocumentElement(element);
- Create a ticketCreate a ticket
Similar blocks of code found in 4 locations. Consider refactoring. Open
<Tooltip>
<TooltipTrigger asChild>
<Button
aria-label="Share"
className="rounded-full p-3 hover:text-blue-500 dark:hover:text-blue-300"
- Read upRead up
- Create a ticketCreate a ticket
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 79.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
<Tooltip>
<TooltipTrigger asChild>
<Button
aria-label="Edit"
className="rounded-full p-3 hover:text-green-500 dark:hover:text-green-300"
- Read upRead up
- Create a ticketCreate a ticket
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 79.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
<Tooltip>
<TooltipTrigger asChild>
<Button
aria-label="Stats"
className="rounded-full p-3 hover:text-orange-500 dark:hover:text-orange-300"
- Read upRead up
- Create a ticketCreate a ticket
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 79.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
<Tooltip>
<TooltipTrigger asChild>
<Button
aria-label="Like"
className="rounded-full p-3 hover:text-red-500 dark:hover:text-red-300"
- Read upRead up
- Create a ticketCreate a ticket
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 79.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File Popover.js
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
arrow,
autoUpdate,
flip,
FloatingArrow,
- Create a ticketCreate a ticket
File Composite.tsx
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as React from 'react';
import {useMergeRefs} from '../hooks/useMergeRefs';
import {useEffectEvent} from '../hooks/utils/useEffectEvent';
import type {Dimensions} from '../types';
- Create a ticketCreate a ticket
Function createVirtualElement
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createVirtualElement(
domElement: Element | null | undefined,
data: {
axis: 'x' | 'y' | 'both';
dataRef: React.MutableRefObject<ContextData>;
- Create a ticketCreate a ticket
Function useFloatingRootContext
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useFloatingRootContext(
options: UseFloatingRootContextOptions,
): FloatingRootContext {
const {
open = false,
- Create a ticketCreate a ticket
Function SomethingWentWrong
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const SomethingWentWrong = (props: SomethingWentWrongProps) => {
const [currentSerializedData] = useSerializedData();
const {inspectDocument: resetInspection} = useDevtools();
const handleReload = React.useCallback(
- Create a ticketCreate a ticket
Function getBoundingClientRect
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getBoundingClientRect(
element: Element | VirtualElement,
includeScale = false,
isFixedStrategy = false,
offsetParent?: Element | Window,
- Create a ticketCreate a ticket
Function useFloating
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function useFloating<RT extends ReferenceType = ReferenceType>(
options: UseFloatingOptions = {},
): UseFloatingReturn<RT> {
const {
placement = 'bottom',
- Read upRead up
- Create a ticketCreate a ticket
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 createController
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const createController = (defaultView: Window): Controller => {
let selectedElement: HTMLElementWithMetadata | null = null;
const observer = new MutationObserver((mutations) => {
if (!selectedElement) {
return;
- Read upRead up
- Create a ticketCreate a ticket
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 Shift
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Shift() {
const [boundary, setBoundary] = useState();
useEffect(() => {
if (boundary) {
- Create a ticketCreate a ticket
Function Result12
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Result12 = () => {
const [arrowEl, setArrowEl] = useState(null);
const {
refs,
- Create a ticketCreate a ticket
Function useDelayGroup
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useDelayGroup(
context: FloatingRootContext,
options: UseGroupOptions = {},
): GroupContext {
const {open, onOpenChange, floatingId} = context;
- Create a ticketCreate a ticket
Function DialogContent
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function DialogContent(props, propRef) {
const {context: floatingContext, ...context} =
useDialogContext();
const ref = useMergeRefs([
context.refs.setFloating,
- Create a ticketCreate a ticket
Function mergeProps
has 50 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> {
- Create a ticketCreate a ticket