kurpachsv/react-gallery

View on GitHub
src/Gallery.js

Summary

Maintainability
F
3 days
Test Coverage

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

        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

              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

              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

                                          <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

              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

                      } 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

              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

              There are no issues that match your filters.

              Category
              Status