reactjs/redux

View on GitHub

Showing 118 of 118 total issues

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

export default function todos(state = initialState, action) {
  switch (action.type) {
    case ADD_TODO:
      return [
        ...state,
Severity: Minor
Found in examples/todomvc/src/reducers/todos.js - About 1 hr to fix

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

        it('should have class selected if active', () => {
          const { output } = setup({ active: true })
          expect(output.props.className).toBe('selected')
        })
    Severity: Major
    Found in examples/todomvc/src/components/Link.spec.js and 2 other locations - About 1 hr to fix
    examples/todomvc/src/components/TodoTextInput.spec.js on lines 39..42
    examples/todomvc/src/components/TodoTextInput.spec.js on lines 44..47

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

    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('should render correctly when editing=true', () => {
          const { output } = setup({ editing: true })
          expect(output.props.className).toEqual('edit')
        })
    Severity: Major
    Found in examples/todomvc/src/components/TodoTextInput.spec.js and 2 other locations - About 1 hr to fix
    examples/todomvc/src/components/Link.spec.js on lines 34..37
    examples/todomvc/src/components/TodoTextInput.spec.js on lines 44..47

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

    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 setup has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function setup(id, counter, childIds, parentId) {
      const actions = {
        increment: jest.fn(),
        removeChild: jest.fn(),
        deleteNode: jest.fn(),
    Severity: Minor
    Found in examples/tree-view/src/containers/Node.spec.js - About 1 hr to fix

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

        render() {
          const {
            isFetching,
            nextPageUrl,
            pageCount,
      Severity: Minor
      Found in examples/real-world/src/components/List.js - About 1 hr to fix

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

        export function miniKindOf(val: any): string {
          if (val === void 0) return 'undefined'
          if (val === null) return 'null'
        
          const type = typeof val
        Severity: Minor
        Found in src/utils/kindOf.ts - About 1 hr to fix

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

              it('should render correctly when newTodo=true', () => {
                const { output } = setup({ newTodo: true })
                expect(output.props.className).toEqual('new-todo')
              })
          Severity: Major
          Found in examples/todomvc/src/components/TodoTextInput.spec.js and 2 other locations - About 1 hr to fix
          examples/todomvc/src/components/Link.spec.js on lines 34..37
          examples/todomvc/src/components/TodoTextInput.spec.js on lines 39..42

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

          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 setup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const setup = () => {
            const props = {
              filteredTodos: [
                {
                  text: 'Use Redux',
          Severity: Minor
          Found in examples/todomvc/src/components/TodoList.spec.js - About 1 hr to fix

            Function assertReducerShape has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function assertReducerShape(reducers: {
              [key: string]: Reducer<any, any, any>
            }) {
              Object.keys(reducers).forEach(key => {
                const reducer = reducers[key]
            Severity: Minor
            Found in src/combineReducers.ts - About 1 hr to fix

              Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  const { counter, parentId, childIds } = this.props
                  return (
                    <div>
                      Counter: {counter}{' '}
              Severity: Minor
              Found in examples/tree-view/src/containers/Node.js - About 1 hr to fix

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

                const fetchRepo = fullName => ({
                  [CALL_API]: {
                    types: [REPO_REQUEST, REPO_SUCCESS, REPO_FAILURE],
                    endpoint: `repos/${fullName}`,
                    schema: Schemas.REPO
                Severity: Major
                Found in examples/real-world/src/actions/index.js and 1 other location - About 1 hr to fix
                examples/real-world/src/actions/index.js on lines 9..15

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

                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 fetchUser = login => ({
                  [CALL_API]: {
                    types: [USER_REQUEST, USER_SUCCESS, USER_FAILURE],
                    endpoint: `users/${login}`,
                    schema: Schemas.USER
                Severity: Major
                Found in examples/real-world/src/actions/index.js and 1 other location - About 1 hr to fix
                examples/real-world/src/actions/index.js on lines 36..42

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

                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

                    expect(
                      todos(
                        [
                          {
                            text: 'Use Redux',
                Severity: Minor
                Found in examples/todomvc/src/reducers/todos.spec.js and 1 other location - About 55 mins to fix
                examples/todos/src/reducers/todos.spec.js on lines 51..87

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

                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 fetchStargazers = (fullName, nextPageUrl) => ({
                  fullName,
                  [CALL_API]: {
                    types: [STARGAZERS_REQUEST, STARGAZERS_SUCCESS, STARGAZERS_FAILURE],
                    endpoint: nextPageUrl,
                Severity: Minor
                Found in examples/real-world/src/actions/index.js and 1 other location - About 55 mins to fix
                examples/real-world/src/actions/index.js on lines 63..70

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

                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 fetchStarred = (login, nextPageUrl) => ({
                  login,
                  [CALL_API]: {
                    types: [STARRED_REQUEST, STARRED_SUCCESS, STARRED_FAILURE],
                    endpoint: nextPageUrl,
                Severity: Minor
                Found in examples/real-world/src/actions/index.js and 1 other location - About 55 mins to fix
                examples/real-world/src/actions/index.js on lines 92..99

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

                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

                    expect(
                      todos(
                        [
                          {
                            text: 'Run the tests',
                Severity: Minor
                Found in examples/todos/src/reducers/todos.spec.js and 1 other location - About 55 mins to fix
                examples/todomvc/src/reducers/todos.spec.js on lines 56..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 54.

                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 getUnexpectedStateShapeWarningMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function getUnexpectedStateShapeWarningMessage(
                  inputState: object,
                  reducers: { [key: string]: Reducer<any, any, any> },
                  action: Action,
                  unexpectedKeyCache: { [key: string]: true }
                Severity: Minor
                Found in src/combineReducers.ts - 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 2 locations. Consider refactoring.
                Open

                    it('should disable button', () => {
                      const { button } = setup(productProps)
                      expect(button.prop('disabled')).toEqual('disabled')
                    })
                Severity: Minor
                Found in examples/shopping-cart/src/components/ProductItem.spec.js and 1 other location - About 55 mins to fix
                examples/shopping-cart/src/components/ProductItem.spec.js on lines 46..49

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

                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 stateAfter = {
                      node_0: {
                        id: 'node_0',
                        counter: 0,
                        childIds: ['node_1']
                Severity: Major
                Found in examples/tree-view/src/reducers/index.spec.js and 2 other locations - About 55 mins to fix
                examples/tree-view/src/reducers/index.spec.js on lines 85..96
                examples/tree-view/src/reducers/index.spec.js on lines 138..149

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

                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

                if (process.env.NODE_ENV === 'production') {
                  module.exports = require('./Root.prod')
                } else {
                  module.exports = require('./Root.dev')
                }
                Severity: Minor
                Found in examples/real-world/src/containers/Root.js and 1 other location - About 55 mins to fix
                examples/real-world/src/store/configureStore.js on lines 1..5

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

                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