Showing 19 of 1,067 total issues
Function CursorPosition
has 219 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const CursorPosition = (props: PropTypes): JSX.Element => {
const {
activationInteractionMouse,
activationInteractionTouch,
children,
Function ReactImageMagnify
has 218 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ReactImageMagnify = (props: ReactImageMagnifyProps): JSX.Element => {
const {
activationInteractionHint,
activationInteractionMouse = INTERACTIONS.hover,
activationInteractionTouch = INTERACTIONS.press,
File CursorPosition.tsx
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
HTMLProps,
KeyboardEvent,
MouseEvent as ReactMouseEvent,
TouchEvent,
Function ReactImageMagnify
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export const ReactImageMagnify = (props: ReactImageMagnifyProps): JSX.Element => {
const {
activationInteractionHint,
activationInteractionMouse = INTERACTIONS.hover,
activationInteractionTouch = INTERACTIONS.press,
- Read upRead up
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 MagnifyContainer
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MagnifyContainer = (props: PropTypes): JSX.Element | null => {
const {
containerDimensions,
cursorOffset,
fadeDurationInMs = 0,
Function CursorPosition
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export const CursorPosition = (props: PropTypes): JSX.Element => {
const {
activationInteractionMouse,
activationInteractionTouch,
children,
- Read upRead up
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 MagnifyContainerPortal
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MagnifyContainerPortal = forwardRef<HTMLImageElement, PropTypes>((props: PropTypes, ref): JSX.Element => {
const {
portalProps = {},
...rest
} = props;
File ReactImageMagnify.tsx
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { primaryInput } from 'detect-it';
import {
CSSProperties,
MouseEvent,
TouchEvent,
Function DefaultHint
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const DefaultHint = memo((props: PropTypes): JSX.Element => {
const {
isMouseDetected,
isTouchDetected,
hintTextMouse,
Function PositiveSpaceLens
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const PositiveSpaceLens = forwardRef<HTMLImageElement, LensProps>((props, ref): JSX.Element | null => {
const {
isActive,
isPositionOutside,
fadeDurationInMs,
Function LensRight
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const LensRight = forwardRef<HTMLImageElement, LensProps>((props: LensProps, ref): JSX.Element | null => {
const {
cursorOffset,
position,
fadeDurationInMs,
Function LensLeft
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const LensLeft = forwardRef<HTMLImageElement, LensProps>((props, ref): JSX.Element | null => {
const {
cursorOffset,
position,
fadeDurationInMs,
Function LensBottom
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const LensBottom = forwardRef<HTMLImageElement, LensProps>((props: LensProps, ref): JSX.Element | null => {
const {
cursorOffset,
position,
fadeDurationInMs,
Function LensTop
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const LensTop = forwardRef<HTMLImageElement, LensProps>((props: LensProps, ref): JSX.Element | null => {
const {
cursorOffset,
position,
fadeDurationInMs,
Function clamp
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function clamp(value: number, min: number, max: number): number {
return min < max
? (value < min ? min : value > max ? max : value)
: (value < max ? max : value > min ? min : value);
}
- Read upRead up
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 getEnlargedImageContainerDimension
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function getEnlargedImageContainerDimension(
containerDimension: string | number,
smallImageDimension: string | number,
scale: number | undefined,
isInPlaceMode: boolean | undefined,
- Read upRead up
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 Lens
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Lens = (props: PropTypes): JSX.Element => {
const {
fadeDurationInMs = 0,
isActive,
isPositionOutside,
Function getLensModeMagnifiedImageCoordinates
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
containerDimensions: ContainerDimensions,
cursorOffset: Point,
magnifiedImage: ContainerDimensions,
position: Point,
image: ContainerDimensions,
Function MagnifyContainer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const MagnifyContainer = (props: PropTypes): JSX.Element | null => {
const {
containerDimensions,
cursorOffset,
fadeDurationInMs = 0,
- Read upRead up
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"