JulienPradet/react-flip

View on GitHub

Showing 8 of 39 total issues

File ReactFlipContainer.test.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component } from 'react';
import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import ReactFlipContainer, { STATIC } from './ReactFlipContainer';
import ReactFlipElement from './ReactFlipElement';
Severity: Minor
Found in src/ReactFlipContainer.test.js - About 4 hrs to fix

    File Flip.test.js has 276 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Flip from './Flip';
    
    const createMock = () => {
      let current;
      return {
    Severity: Minor
    Found in src/Flip.test.js - About 2 hrs to fix

      Function ReactFlipElement has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      const ReactFlipElement = (options = {}) =>
        BaseComponent => {
          const getOptions = props =>
            typeof options === 'function' ? () => options(props()) : options;
      
      
      Severity: Minor
      Found in src/ReactFlipElement.js - 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 invert has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        invert() {
          if (!this._first || !this._last) {
            if (process.env.NODE_ENV === 'development' && this.debug) {
              console.warn(
                this.options.id,
      Severity: Minor
      Found in src/Flip.js - About 1 hr to fix

        Function ReactFlipElement has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          BaseComponent => {
            const getOptions = props =>
              typeof options === 'function' ? () => options(props()) : options;
        
            class ReactFlipElement extends Component {
        Severity: Minor
        Found in src/ReactFlipElement.js - About 1 hr to fix

          Function componentDidUpdate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            componentDidUpdate(prevProps, prevState) {
              if (shouldAnimate(this.props)) {
                if (this.props !== prevProps) {
                  if (this.props.defer || this.props.forceDefer) {
                    if (!this.props.forceDefer) {
          Severity: Minor
          Found in src/ReactFlipContainer.js - 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 invert has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            invert() {
              if (!this._first || !this._last) {
                if (process.env.NODE_ENV === 'development' && this.debug) {
                  console.warn(
                    this.options.id,
          Severity: Minor
          Found in src/Flip.js - 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 componentWillReceiveProps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            componentWillReceiveProps(nextProps) {
              if (shouldAnimate(nextProps) && this.props !== nextProps) {
                if (nextProps.defer || nextProps.forceDefer) {
                  if (!nextProps.forceDefer) {
                    this.first({ deferred: false });
          Severity: Minor
          Found in src/ReactFlipContainer.js - About 55 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