gooftroop/react-image-magnify

View on GitHub

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,
Severity: Major
Found in src/CursorPosition.tsx - About 1 day to fix

    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,
    Severity: Major
    Found in src/ReactImageMagnify.tsx - About 1 day to fix

      File CursorPosition.tsx has 362 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
          HTMLProps,
          KeyboardEvent,
          MouseEvent as ReactMouseEvent,
          TouchEvent,
      Severity: Minor
      Found in src/CursorPosition.tsx - About 4 hrs to fix

        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,
        Severity: Minor
        Found in src/ReactImageMagnify.tsx - About 3 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 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,
        Severity: Major
        Found in src/MaginfyContainer.tsx - About 3 hrs to fix

          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,
          Severity: Minor
          Found in src/CursorPosition.tsx - About 2 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 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;
          Severity: Major
          Found in src/MagnifyContainerPortal.tsx - About 2 hrs to fix

            File ReactImageMagnify.tsx has 263 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { primaryInput } from 'detect-it';
            import {
                CSSProperties,
                MouseEvent,
                TouchEvent,
            Severity: Minor
            Found in src/ReactImageMagnify.tsx - About 2 hrs to fix

              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,
              Severity: Major
              Found in src/hint/DefaultHint.tsx - About 2 hrs to fix

                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,
                Severity: Minor
                Found in src/lens/positive-space/index.tsx - About 1 hr to fix

                  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,
                  Severity: Minor
                  Found in src/lens/negative-space/LensRight.tsx - About 1 hr to fix

                    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,
                    Severity: Minor
                    Found in src/lens/negative-space/LensLeft.tsx - About 1 hr to fix

                      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,
                      Severity: Minor
                      Found in src/lens/negative-space/LensBottom.tsx - About 1 hr to fix

                        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,
                        Severity: Minor
                        Found in src/lens/negative-space/LensTop.tsx - About 1 hr to fix

                          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);
                          }
                          Severity: Minor
                          Found in src/lib/clamp.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 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,
                          Severity: Minor
                          Found in src/lib/dimensions.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 Lens has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const Lens = (props: PropTypes): JSX.Element => {
                              const {
                                  fadeDurationInMs = 0,
                                  isActive,
                                  isPositionOutside,
                          Severity: Minor
                          Found in src/lens/negative-space/Lens.tsx - About 1 hr to fix

                            Function getLensModeMagnifiedImageCoordinates has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                containerDimensions: ContainerDimensions,
                                cursorOffset: Point,
                                magnifiedImage: ContainerDimensions,
                                position: Point,
                                image: ContainerDimensions,
                            Severity: Minor
                            Found in src/lib/imageCoordinates.ts - About 35 mins to fix

                              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,
                              Severity: Minor
                              Found in src/MaginfyContainer.tsx - About 25 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