jmeas/redux-resource

View on GitHub

Showing 77 of 77 total issues

Avoid deeply nested control flow statements.
Open

            if (typeof r !== 'string' && typeof r !== 'number') {
              warning(
                `A resource without an ID was passed to an action with type ` +
                  `${
                    action.type
Severity: Major
Found in packages/redux-resource/src/update-resources-plugin/index.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (
                  (!r.id && r.id !== 0) ||
                  (typeof r.id !== 'string' && typeof r.id !== 'number')
                ) {
                  warning(
    Severity: Major
    Found in packages/redux-resource/src/update-resources-plugin/index.js - About 45 mins to fix

      Function upsertMeta has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function upsertMeta(meta, newMeta, mergeMeta) {
        if (!newMeta) {
          return meta;
        }
      
      
      Severity: Minor
      Found in packages/redux-resource/src/utils/upsert-meta.js - About 45 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

          if (!typeToUse) {
            console.warn(
              `A resourceType was not passed to a Redux Resource Action ` +
                `creator. A resourceType must be passed so that Redux Resource ` +
                `knows which resource slice to update. Refer to the Request Actions ` +
      Severity: Minor
      Found in packages/redux-resource-xhr/src/index.js and 1 other location - About 35 mins to fix
      packages/redux-resource-xhr/src/index.js on lines 47..54

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

      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 (!url && !uri) {
            console.warn(
              `No URL was passed to a Redux Resource action creator. You must ` +
                `pass either "xhrOptions.url" or "xhrOptions.uri". For more, refer to ` +
                `the Redux Resource XHR documentation: ` +
      Severity: Minor
      Found in packages/redux-resource-xhr/src/index.js and 1 other location - About 35 mins to fix
      packages/redux-resource-xhr/src/index.js on lines 31..38

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

      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 (mergeMetaOption) {
            const currentResource = shallowClone[id];
            resourceToInsert = Object.assign({}, currentResource, resource);
          } else {
            resourceToInsert = resource;
      Severity: Minor
      Found in packages/redux-resource/src/utils/upsert-meta.js and 1 other location - About 35 mins to fix
      packages/redux-resource/src/utils/upsert-resources.js on lines 50..55

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

      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

      Identical blocks of code found in 4 locations. Consider refactoring.
      Open

        plugins: [
          nodeResolve({
            jsnext: true
          }),
          babel({
      Severity: Major
      Found in packages/redux-resource-prop-types/rollup.config.js and 3 other locations - About 35 mins to fix
      packages/redux-resource-action-creators/rollup.config.js on lines 14..24
      packages/redux-resource-plugins/rollup.config.js on lines 14..24
      packages/redux-resource/rollup.config.js on lines 10..20

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

      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 (mergeResourcesOption) {
              const currentResource = shallowClone[id];
              resourceToInsert = Object.assign({}, currentResource, resourceObj);
            } else {
              resourceToInsert = resourceObj;
      Severity: Minor
      Found in packages/redux-resource/src/utils/upsert-resources.js and 1 other location - About 35 mins to fix
      packages/redux-resource/src/utils/upsert-meta.js on lines 22..27

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

      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

      Identical blocks of code found in 4 locations. Consider refactoring.
      Open

        plugins: [
          nodeResolve({
            jsnext: true
          }),
          babel({
      Severity: Major
      Found in packages/redux-resource-action-creators/rollup.config.js and 3 other locations - About 35 mins to fix
      packages/redux-resource-plugins/rollup.config.js on lines 14..24
      packages/redux-resource-prop-types/rollup.config.js on lines 15..25
      packages/redux-resource/rollup.config.js on lines 10..20

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

      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

      Identical blocks of code found in 4 locations. Consider refactoring.
      Open

        plugins: [
          nodeResolve({
            jsnext: true
          }),
          babel({
      Severity: Major
      Found in packages/redux-resource-plugins/rollup.config.js and 3 other locations - About 35 mins to fix
      packages/redux-resource-action-creators/rollup.config.js on lines 14..24
      packages/redux-resource-prop-types/rollup.config.js on lines 15..25
      packages/redux-resource/rollup.config.js on lines 10..20

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

      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

      Identical blocks of code found in 4 locations. Consider refactoring.
      Open

        plugins: [
          nodeResolve({
            jsnext: true
          }),
          babel({
      Severity: Major
      Found in packages/redux-resource/rollup.config.js and 3 other locations - About 35 mins to fix
      packages/redux-resource-action-creators/rollup.config.js on lines 14..24
      packages/redux-resource-plugins/rollup.config.js on lines 14..24
      packages/redux-resource-prop-types/rollup.config.js on lines 15..25

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

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

      const createActionCreators = (crudType, actionDefaults = {}) => {
        const { resourceName, resourceType } = actionDefaults;
        const typeToUse = resourceType || resourceName;
        const uppercaseCrud =
          typeof crudType === 'string' ? crudType.toUpperCase() : '';
      Severity: Minor
      Found in packages/redux-resource-action-creators/src/index.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

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

              `You called "getStatus" with path "${statusLocation}", which resolved ` +
                `to a value of NULL. The NULL request status was renamed to IDLE in ` +
                `Redux Resource v3.0.0. You may need to verify that your code is ` +
                `compatible with Redux Resource v3.0.0. ` +
                `For more information, refer to the documentation for request statuses at: ` +
      Severity: Minor
      Found in packages/redux-resource/src/utils/get-status.js and 1 other location - About 35 mins to fix
      packages/redux-resource/src/utils/get-status.js on lines 30..34

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

      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

              `You called "getStatus" with path "${statusLocation}", which resolved ` +
                `to a value that is not a valid resource status. You may want to ` +
                `check that this path is correct. ` +
                `Read more about getStatus on the documentation page: ` +
                `https://redux-resource.js.org/docs/api-reference/get-status.html`,
      Severity: Minor
      Found in packages/redux-resource/src/utils/get-status.js and 1 other location - About 35 mins to fix
      packages/redux-resource/src/utils/get-status.js on lines 41..45

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

      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

      Avoid too many return statements within this function.
      Open

          return state;
      Severity: Major
      Found in packages/redux-resource-plugins/src/selection.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return byId ? resourceArrayToObject(resourcesList) : resourcesList;
        Severity: Major
        Found in packages/redux-resource/src/utils/get-resources.js - About 30 mins to fix

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

          export default function warning(message, code) {
            // This ensures that each warning type is only logged out one time
            if (code) {
              if (codeCache[code]) {
                return;
          Severity: Minor
          Found in packages/redux-resource/src/utils/warning.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