acdlite/recompose

View on GitHub

Showing 123 of 123 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const enhacer: HOC<*, EnhancedCompProps> = compose(
  toClass,
  withProps(props => ({
    eA: (props.eA: number),
    // $ExpectError eA nor any nor string
Severity: Major
Found in src/packages/recompose/__tests__/types/test_toClass.js and 2 other locations - About 2 hrs to fix
src/packages/recompose/__tests__/types/test_onlyUpdateForPropTypes.js on lines 19..30
src/packages/recompose/__tests__/types/test_pure.js on lines 19..30

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 87.

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const enhacer: HOC<*, EnhancedCompProps> = compose(
  onlyUpdateForPropTypes,
  withProps(props => ({
    eA: (props.eA: number),
    // $ExpectError eA nor any nor string
src/packages/recompose/__tests__/types/test_pure.js on lines 19..30
src/packages/recompose/__tests__/types/test_toClass.js on lines 19..30

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 87.

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const enhacer: HOC<*, EnhancedCompProps> = compose(
  pure,
  withProps(props => ({
    eA: (props.eA: number),
    // $ExpectError eA nor any nor string
Severity: Major
Found in src/packages/recompose/__tests__/types/test_pure.js and 2 other locations - About 2 hrs to fix
src/packages/recompose/__tests__/types/test_onlyUpdateForPropTypes.js on lines 19..30
src/packages/recompose/__tests__/types/test_toClass.js on lines 19..30

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 87.

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const Comp = ({ hello, eA }) =>
  <div>
    {(hello: string)}
    {(eA: number)}
    {
src/packages/recompose/__tests__/types/test_defaultProps.js on lines 10..22

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 77.

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const Comp = ({ hello, eA }) =>
  <div>
    {(hello: string)}
    {(eA: number)}
    {
Severity: Major
Found in src/packages/recompose/__tests__/types/test_defaultProps.js and 1 other location - About 2 hrs to fix
src/packages/recompose/__tests__/types/test_withPropsOnChange.js on lines 10..22

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 77.

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  withProps(props => ({
    hello: (props.hello: string),
    eA: (props.eA: number),
    // $ExpectError hello nor any nor number
    helloErr: (props.hello: number),
src/packages/recompose/__tests__/types/test_defaultProps.js on lines 28..35
src/packages/recompose/__tests__/types/test_withPropsOnChange.js on lines 57..64

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 74.

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  withProps(props => ({
    hello: (props.hello: string),
    eA: (props.eA: number),
    // $ExpectError hello nor any nor number
    helloErr: (props.hello: number),
src/packages/recompose/__tests__/types/test_withPropsOnChange.js on lines 28..35
src/packages/recompose/__tests__/types/test_withPropsOnChange.js on lines 57..64

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 74.

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  withProps(props => ({
    hello: (props.hello: string),
    eA: (props.eA: number),
    // $ExpectError hello nor any nor number
    helloErr: (props.hello: number),
src/packages/recompose/__tests__/types/test_defaultProps.js on lines 28..35
src/packages/recompose/__tests__/types/test_withPropsOnChange.js on lines 28..35

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 74.

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

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        withProps(props => ({
          // $ExpectError eA nor any nor string
          eAErr: (props.eA: string),
          // $ExpectError x nor any nor string
          xErr: (props.x: string),
      Severity: Major
      Found in src/packages/recompose/__tests__/types/test_branch.js and 1 other location - About 1 hr to fix
      src/packages/recompose/__tests__/types/test_branch.js on lines 82..89

      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 61.

      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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        withProps(props => ({
          // $ExpectError eA nor any nor string
          eAErr: (props.eA: string),
          // $ExpectError x nor any nor string
          xErr: (props.x: string),
      Severity: Major
      Found in src/packages/recompose/__tests__/types/test_branch.js and 1 other location - About 1 hr to fix
      src/packages/recompose/__tests__/types/test_branch.js on lines 98..105

      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 61.

      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

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

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

            const Comp = ({ eA }) =>
              <div>
                {(eA: number)}
                {
                  // $ExpectError eA nor any nor string
            Severity: Major
            Found in src/packages/recompose/__tests__/types/test_statics.js and 8 other locations - About 45 mins to fix
            src/packages/recompose/__tests__/types/test_branch.js on lines 17..24
            src/packages/recompose/__tests__/types/test_getContext.js on lines 15..22
            src/packages/recompose/__tests__/types/test_onlyUpdateForKeys.js on lines 10..17
            src/packages/recompose/__tests__/types/test_onlyUpdateForPropTypes.js on lines 10..17
            src/packages/recompose/__tests__/types/test_pure.js on lines 10..17
            src/packages/recompose/__tests__/types/test_shouldUpdate.js on lines 10..17
            src/packages/recompose/__tests__/types/test_toClass.js on lines 10..17
            src/packages/recompose/__tests__/types/test_withContext.js on lines 10..17

            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 50.

            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

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

            const Comp = ({ eA }) =>
              <div>
                {(eA: number)}
                {
                  // $ExpectError eA nor any nor string
            Severity: Major
            Found in src/packages/recompose/__tests__/types/test_branch.js and 8 other locations - About 45 mins to fix
            src/packages/recompose/__tests__/types/test_getContext.js on lines 15..22
            src/packages/recompose/__tests__/types/test_onlyUpdateForKeys.js on lines 10..17
            src/packages/recompose/__tests__/types/test_onlyUpdateForPropTypes.js on lines 10..17
            src/packages/recompose/__tests__/types/test_pure.js on lines 10..17
            src/packages/recompose/__tests__/types/test_shouldUpdate.js on lines 10..17
            src/packages/recompose/__tests__/types/test_statics.js on lines 20..27
            src/packages/recompose/__tests__/types/test_toClass.js on lines 10..17
            src/packages/recompose/__tests__/types/test_withContext.js on lines 10..17

            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 50.

            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

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

            const Comp = ({ eA }) =>
              <div>
                {(eA: number)}
                {
                  // $ExpectError eA nor any nor string
            Severity: Major
            Found in src/packages/recompose/__tests__/types/test_getContext.js and 8 other locations - About 45 mins to fix
            src/packages/recompose/__tests__/types/test_branch.js on lines 17..24
            src/packages/recompose/__tests__/types/test_onlyUpdateForKeys.js on lines 10..17
            src/packages/recompose/__tests__/types/test_onlyUpdateForPropTypes.js on lines 10..17
            src/packages/recompose/__tests__/types/test_pure.js on lines 10..17
            src/packages/recompose/__tests__/types/test_shouldUpdate.js on lines 10..17
            src/packages/recompose/__tests__/types/test_statics.js on lines 20..27
            src/packages/recompose/__tests__/types/test_toClass.js on lines 10..17
            src/packages/recompose/__tests__/types/test_withContext.js on lines 10..17

            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 50.

            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

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

            const Comp = ({ eA }) =>
              <div>
                {(eA: number)}
                {
                  // $ExpectError eA nor any nor string
            Severity: Major
            Found in src/packages/recompose/__tests__/types/test_toClass.js and 8 other locations - About 45 mins to fix
            src/packages/recompose/__tests__/types/test_branch.js on lines 17..24
            src/packages/recompose/__tests__/types/test_getContext.js on lines 15..22
            src/packages/recompose/__tests__/types/test_onlyUpdateForKeys.js on lines 10..17
            src/packages/recompose/__tests__/types/test_onlyUpdateForPropTypes.js on lines 10..17
            src/packages/recompose/__tests__/types/test_pure.js on lines 10..17
            src/packages/recompose/__tests__/types/test_shouldUpdate.js on lines 10..17
            src/packages/recompose/__tests__/types/test_statics.js on lines 20..27
            src/packages/recompose/__tests__/types/test_withContext.js on lines 10..17

            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 50.

            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

            Severity
            Category
            Status
            Source
            Language