kurpachsv/react-gallery

View on GitHub

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

        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

            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

                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