acdlite/recompose

View on GitHub

Showing 10 of 123 total issues

Function withPropsOnChange has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const withPropsOnChange = (shouldMapOrKeys, propsMapper) => BaseComponent => {
  const factory = createFactory(BaseComponent)
  const shouldMap =
    typeof shouldMapOrKeys === 'function'
      ? shouldMapOrKeys
Severity: Minor
Found in src/packages/recompose/withPropsOnChange.js - About 1 hr to fix

    Function withReducer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ) => BaseComponent => {
      const factory = createFactory(BaseComponent)
      class WithReducer extends Component {
        state = {
          stateValue: this.initializeStateValue(),
    Severity: Minor
    Found in src/packages/recompose/withReducer.js - About 1 hr to fix

      Function withHandlers has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const withHandlers = handlers => BaseComponent => {
        const factory = createFactory(BaseComponent)
        class WithHandlers extends Component {
          handlers = mapValues(
            typeof handlers === 'function' ? handlers(this.props) : handlers,
      Severity: Minor
      Found in src/packages/recompose/withHandlers.js - About 1 hr to fix

        Function withState has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ) => BaseComponent => {
          const factory = createFactory(BaseComponent)
          class WithState extends Component {
            state = {
              stateValue:
        Severity: Minor
        Found in src/packages/recompose/withState.js - About 1 hr to fix

          Function withStateHandlers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const withStateHandlers = (initialState, stateUpdaters) => BaseComponent => {
            const factory = createFactory(BaseComponent)
          
            class WithStateHandlers extends Component {
              state = typeof initialState === 'function'
          Severity: Minor
          Found in src/packages/recompose/withStateHandlers.js - About 1 hr to fix

            Function withReducer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            const withReducer = (
              stateName,
              dispatchName,
              reducer,
              initialState
            Severity: Minor
            Found in src/packages/recompose/withReducer.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

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

            const branch = (test, left, right = identity) => BaseComponent => {
              let leftFactory
              let rightFactory
              const Branch = props => {
                if (test(props)) {
            Severity: Minor
            Found in src/packages/recompose/branch.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 shallowEqual has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function shallowEqual(objA, objB) {
              if (is(objA, objB)) {
                return true
              }
            
            
            Severity: Minor
            Found in src/packages/recompose/shallowEqual.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 withPropsOnChange has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            const withPropsOnChange = (shouldMapOrKeys, propsMapper) => BaseComponent => {
              const factory = createFactory(BaseComponent)
              const shouldMap =
                typeof shouldMapOrKeys === 'function'
                  ? shouldMapOrKeys
            Severity: Minor
            Found in src/packages/recompose/withPropsOnChange.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

            Avoid too many return statements within this function.
            Open

              return true
            Severity: Major
            Found in src/packages/recompose/shallowEqual.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language