faceyspacey/react-universal-component

View on GitHub

Showing 12 of 42 total issues

Function requireUniversalModule has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

export default function requireUniversalModule<Props: Props>(
  universalConfig: Config | ConfigFunc,
  options: ModuleOptions,
  props: Props,
  prevProps?: Props
Severity: Minor
Found in src/requireUniversalModule.js - About 1 day 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 universal has 221 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function universal<Props: Props>(
  asyncModule: Config | ConfigFunc,
  opts: ComponentOptions = {}
) {
  const {
Severity: Major
Found in src/index.js - About 1 day to fix

    File index.js has 530 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // @noflow
    import path from 'path'
    import React from 'react'
    import renderer from 'react-test-renderer'
    
    
    Severity: Major
    Found in __tests__/index.js - About 1 day to fix

      Function universal has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function universal<Props: Props>(
        asyncModule: Config | ConfigFunc,
        opts: ComponentOptions = {}
      ) {
        const {
      Severity: Minor
      Found in src/index.js - About 7 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 requireUniversalModule has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function requireUniversalModule<Props: Props>(
        universalConfig: Config | ConfigFunc,
        options: ModuleOptions,
        props: Props,
        prevProps?: Props
      Severity: Major
      Found in src/requireUniversalModule.js - About 4 hrs to fix

        File requireUniversalModule.js has 307 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @noflow
        import path from 'path'
        import { createPath, waitFor, normalizePath } from '../__test-helpers__'
        
        import req, {
        Severity: Minor
        Found in __tests__/requireUniversalModule.js - About 3 hrs to fix

          File index.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // @flow
          import React from 'react'
          import PropTypes from 'prop-types'
          import hoist from 'hoist-non-react-statics'
          import req from './requireUniversalModule'
          Severity: Minor
          Found in src/index.js - About 2 hrs to fix

            Function init has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                init(props) {
                  const { addModule, requireSync, requireAsync, asyncOnly } = req(
                    asyncModule,
                    options,
                    props
            Severity: Minor
            Found in src/index.js - About 1 hr to fix

              Function requireAsync has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const requireAsync = (props: Object): Promise<?any> => {
                  const exp = loadFromCache(chunkName, props, modCache)
                  if (exp) return Promise.resolve(exp)
              
                  const cachedPromise = loadFromPromiseCache(chunkName, props, promCache)
              Severity: Minor
              Found in src/requireUniversalModule.js - About 1 hr to fix

                Function componentDidUpdate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    componentDidUpdate(prevProps: Props) {
                      if (isDynamic || this._asyncOnly) {
                        const { requireSync, requireAsync, shouldUpdate } = req(
                          asyncModule,
                          options,
                Severity: Minor
                Found in src/index.js - About 1 hr to fix

                  Function getConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const getConfig = (
                    isDynamic: ?boolean,
                    universalConfig: Config | ConfigFunc,
                    options: ModuleOptions,
                    props: Props
                  Severity: Minor
                  Found in src/requireUniversalModule.js - About 35 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

                  Function __handleAfter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const __handleAfter = (props, state, isMount, isSync, isServer) => {
                    const { mod, error } = state
                  
                    if (mod && !error) {
                      hoist(UniversalComponent, mod, {
                  Severity: Minor
                  Found in src/helpers.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