kurpachsv/react-gallery

View on GitHub

Showing 17 of 17 total issues

File Gallery.js has 450 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import PropTypes from 'prop-types';
import React, {Component} from 'react';
import equal from 'fast-deep-equal';
import Engine, {
    COLUMN_MAX_HEIGHT,
Severity: Minor
Found in src/Gallery.js - About 6 hrs to fix

    Function renderFixedGallery has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        renderFixedGallery({
            className, fixedRows, rowClassName, columnClassName, imageRenderer, disableObserver, disableActualImage,
            enableDetailView, detailsViewRenderer, fixedBottom, placeholderColor,
            fixedBottomGutterInPecent, fixedImagePlaceholderColor,
        }) {
    Severity: Major
    Found in src/Gallery.js - About 3 hrs to fix

      Function renderGallery has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          renderGallery({
              className, rows, rowClassName, columnClassName, imageRenderer, disableObserver, disableActualImage,
              enableDetailView, detailsViewRenderer, disableLastRowDetecting, placeholderColor,
          }) {
              const {
      Severity: Major
      Found in src/Gallery.js - About 3 hrs to fix

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

                                                                onClick: () => this.handleSelectImage({
                                                                    selectedImageRow: rowIndex,
                                                                    selectedImage: column,
                                                                    selectedRowHeight: newHeight,
                                                                    // eslint-disable-next-line
        Severity: Major
        Found in src/Gallery.js and 1 other location - About 2 hrs to fix
        src/Gallery.js on lines 290..302

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

        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

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

                                                            onClick: () => this.handleSelectImage({
                                                                selectedImageRow: rowIndex,
                                                                selectedImage: column,
                                                                selectedRowHeight: newHeight,
                                                                // eslint-disable-next-line
        Severity: Major
        Found in src/Gallery.js and 1 other location - About 2 hrs to fix
        src/Gallery.js on lines 425..437

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

        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

        Engine has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Engine {
        
            static getMinHeight(items) {
                return Math.min.apply(null,
                    (items.map(item => item.height)));
        Severity: Minor
        Found in src/Engine.js - About 2 hrs to fix

          Function UNSAFE_componentWillMount has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              UNSAFE_componentWillMount() {
                  const {
                      images,
                      columnsMaxCount,
                      columnMaxWidth,
          Severity: Major
          Found in src/Gallery.js - About 2 hrs to fix

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

                                        <div>
                                            {enableDetailView && detailsViewRenderer({
                                                ...row,
                                                visible: rowIndex === selectedImageRow,
                                                selectedImage,
            Severity: Major
            Found in src/Gallery.js and 1 other location - About 1 hr to fix
            src/Gallery.js on lines 309..319

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

            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

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

                                        <div>
                                            {enableDetailView && detailsViewRenderer({
                                                ...row,
                                                visible: rowIndex === selectedImageRow,
                                                selectedImage,
            Severity: Major
            Found in src/Gallery.js and 1 other location - About 1 hr to fix
            src/Gallery.js on lines 448..458

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

            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 renderMasonryGallery has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                renderMasonryGallery({
                    className, columnClassName, imageRenderer, disableObserver, disableActualImage, columns,
                    placeholderColor,
                }) {
                    return (
            Severity: Minor
            Found in src/Gallery.js - About 1 hr to fix

              Function UNSAFE_componentWillReceiveProps has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  UNSAFE_componentWillReceiveProps(nextProps) {
                      if (!equal(this.props, nextProps)) {
              
                          this.engine
                              .setImages(nextProps.images)
              Severity: Minor
              Found in src/Gallery.js - About 1 hr to fix

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

                    close = () => {
                        this.setState({
                            selectedImageRow: null,
                            selectedImageRowPrev: null,
                            selectedImage: null,
                Severity: Minor
                Found in src/Gallery.js and 1 other location - About 50 mins to fix
                src/Gallery.js on lines 346..356

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

                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

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

                        } else {
                            this.setState({
                                selectedImageRow: null,
                                selectedImageRowPrev: null,
                                selectedImage: null,
                Severity: Minor
                Found in src/Gallery.js and 1 other location - About 50 mins to fix
                src/Gallery.js on lines 359..369

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

                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 3 locations. Consider refactoring.
                Open

                    setColumnMaxWidth(columnMaxWidth) {
                        if (!columnMaxWidth || columnMaxWidth < 0) {
                            columnMaxWidth = COLUMN_MAX_WIDTH;
                        }
                        this.columnMaxWidth = columnMaxWidth;
                Severity: Minor
                Found in src/Engine.js and 2 other locations - About 35 mins to fix
                src/Engine.js on lines 61..67
                src/Engine.js on lines 85..91

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

                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 3 locations. Consider refactoring.
                Open

                    setColumnMaxHeight(columnMaxHeight) {
                        if (!columnMaxHeight || columnMaxHeight < 0) {
                            columnMaxHeight = COLUMN_MAX_HEIGHT;
                        }
                        this.columnMaxHeight = columnMaxHeight;
                Severity: Minor
                Found in src/Engine.js and 2 other locations - About 35 mins to fix
                src/Engine.js on lines 61..67
                src/Engine.js on lines 73..79

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

                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 3 locations. Consider refactoring.
                Open

                    setMaxColumnsCount(maxColumnsCount) {
                        if (!maxColumnsCount || maxColumnsCount < 0) {
                            maxColumnsCount = COLUMNS_MAX_COUNT;
                        }
                        this.maxColumnsCount = maxColumnsCount;
                Severity: Minor
                Found in src/Engine.js and 2 other locations - About 35 mins to fix
                src/Engine.js on lines 73..79
                src/Engine.js on lines 85..91

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

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

                const Image = ({
                    className,
                    src,
                    alt,
                    visible,
                Severity: Minor
                Found in src/Image.js - 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