faceyspacey/react-universal-component

View on GitHub

Showing 42 of 42 total issues

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

  it('webpack', async () => {
    global.__webpack_require__ = path => __webpack_modules__[path]

    // modules stored by paths instead of IDs (replicates babel implementation)
    global.__webpack_modules__ = {
Severity: Major
Found in __tests__/index.js and 2 other locations - About 1 day to fix
__tests__/index.js on lines 474..505
__tests__/index.js on lines 528..559

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

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

  it('webpack: dynamic require', async () => {
    global.__webpack_require__ = path => __webpack_modules__[path]

    // modules stored by paths instead of IDs (replicates babel implementation)
    global.__webpack_modules__ = {
Severity: Major
Found in __tests__/index.js and 2 other locations - About 1 day to fix
__tests__/index.js on lines 387..418
__tests__/index.js on lines 528..559

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

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

  it('webpack: dynamic require (babel-plugin)', async () => {
    global.__webpack_require__ = path => __webpack_modules__[path]

    // modules stored by paths instead of IDs (replicates babel implementation)
    global.__webpack_modules__ = {
Severity: Major
Found in __tests__/index.js and 2 other locations - About 1 day to fix
__tests__/index.js on lines 387..418
__tests__/index.js on lines 474..505

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

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

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

  it('babel', async () => {
    const App = createApp()

    flushModuleIds() // insure sets are empty:
    flushChunkNames()
Severity: Major
Found in __tests__/index.js and 2 other locations - About 1 day to fix
__tests__/index.js on lines 453..472
__tests__/index.js on lines 507..526

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

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

  it('babel: dynamic require', async () => {
    const App = createDynamicApp()

    flushModuleIds() // insure sets are empty:
    flushChunkNames()
Severity: Major
Found in __tests__/index.js and 2 other locations - About 1 day to fix
__tests__/index.js on lines 345..364
__tests__/index.js on lines 507..526

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

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

  it('babel: dynamic require (babel-plugin)', async () => {
    const App = createDynamicBablePluginApp()

    flushModuleIds() // insure sets are empty:
    flushChunkNames()
Severity: Major
Found in __tests__/index.js and 2 other locations - About 1 day to fix
__tests__/index.js on lines 345..364
__tests__/index.js on lines 453..472

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

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

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

            it('es5: module.exports resolved', async () => {
              const asyncComponent = createComponent(40, null)
              const Component = universal(asyncComponent, {
                path: path.join(__dirname, '../__fixtures__/component.es5')
              })
          Severity: Major
          Found in __tests__/index.js and 1 other location - About 3 hrs to fix
          __tests__/index.js on lines 216..225

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

          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

            it('es6: default export automatically resolved', async () => {
              const asyncComponent = createComponent(40, null)
              const Component = universal(asyncComponent, {
                path: path.join(__dirname, '../__fixtures__/component')
              })
          Severity: Major
          Found in __tests__/index.js and 1 other location - About 3 hrs to fix
          __tests__/index.js on lines 227..236

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

          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

            return props => (
              <div>
                {props.one ? <Component1 page='component' /> : null}
                {props.two ? <Component2 page='component2' /> : null}
                {props.three ? <Component3 page='component3' /> : null}
          Severity: Major
          Found in __test-helpers__/createApp.js and 1 other location - About 2 hrs to fix
          __test-helpers__/createApp.js on lines 42..48

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

          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

            return props => (
              <div>
                {props.one ? <Component page='component' /> : null}
                {props.two ? <Component page='component2' /> : null}
                {props.three ? <Component page='component3' /> : null}
          Severity: Major
          Found in __test-helpers__/createApp.js and 1 other location - About 2 hrs to fix
          __test-helpers__/createApp.js on lines 85..91

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

          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

            return props => (
              <div>
                {props.one ? <Component1 /> : null}
                {props.two ? <Component2 /> : null}
                {props.three ? <Component3 /> : null}
          Severity: Major
          Found in __test-helpers__/createApp.js and 1 other location - About 2 hrs to fix
          __test-helpers__/createApp.js on lines 25..31

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

          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

            return props => (
              <div>
                {props.one ? <Component1 /> : null}
                {props.two ? <Component2 /> : null}
                {props.three ? <Component3 /> : null}
          Severity: Major
          Found in __test-helpers__/createApp.js and 1 other location - About 2 hrs to fix
          __test-helpers__/createApp.js on lines 66..72

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

          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

          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
              Severity
              Category
              Status
              Source
              Language