dopry/netlify-cms

View on GitHub
src/actions/editorialWorkflow.js

Summary

Maintainability
F
3 days
Test Coverage

File editorialWorkflow.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import uuid from 'uuid';
import { actions as notifActions } from 'redux-notifications';
import { serializeValues } from '../lib/serializeEntryValues';
import { closeEntry } from './editor';
import { BEGIN, COMMIT, REVERT } from 'redux-optimist';
Severity: Minor
Found in src/actions/editorialWorkflow.js - About 2 hrs to fix

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

    export function persistUnpublishedEntry(collection, existingUnpublishedEntry) {
      return (dispatch, getState) => {
        const state = getState();
        const entryDraft = state.entryDraft;
    
    
    Severity: Minor
    Found in src/actions/editorialWorkflow.js - About 1 hr to fix

      Function unpublishedEntryStatusChangePersisted has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function unpublishedEntryStatusChangePersisted(collection, slug, oldStatus, newStatus, transactionID) {
      Severity: Minor
      Found in src/actions/editorialWorkflow.js - About 35 mins to fix

        Function unpublishedEntryStatusChangeRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function unpublishedEntryStatusChangeRequest(collection, slug, oldStatus, newStatus, transactionID) {
        Severity: Minor
        Found in src/actions/editorialWorkflow.js - About 35 mins to fix

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

          export function deleteUnpublishedEntry(collection, slug) {
            return (dispatch, getState) => {
              const state = getState();
              const backend = currentBackend(state.config);
              const transactionID = uuid.v4();
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 1 other location - About 7 hrs to fix
          src/actions/editorialWorkflow.js on lines 303..322

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

          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

          export function publishUnpublishedEntry(collection, slug) {
            return (dispatch, getState) => {
              const state = getState();
              const backend = currentBackend(state.config);
              const transactionID = uuid.v4();
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 1 other location - About 7 hrs to fix
          src/actions/editorialWorkflow.js on lines 282..301

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

          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

          function unpublishedEntryStatusChangePersisted(collection, slug, oldStatus, newStatus, transactionID) {
            return {
              type: UNPUBLISHED_ENTRY_STATUS_CHANGE_SUCCESS,
              payload: { 
                collection,
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 1 other location - About 1 hr to fix
          src/actions/editorialWorkflow.js on lines 126..137

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

          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

          function unpublishedEntryStatusChangeRequest(collection, slug, oldStatus, newStatus, transactionID) {
            return {
              type: UNPUBLISHED_ENTRY_STATUS_CHANGE_REQUEST,
              payload: { 
                collection,
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 1 other location - About 1 hr to fix
          src/actions/editorialWorkflow.js on lines 139..150

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

          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

          function unpublishedEntryPersisted(collection, entry, transactionID) {
            return {
              type: UNPUBLISHED_ENTRY_PERSIST_SUCCESS,
              payload: { 
                collection: collection.get('name'),
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 1 other location - About 1 hr to fix
          src/actions/editorialWorkflow.js on lines 96..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 60.

          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

          function unpublishedEntryPersisting(collection, entry, transactionID) {
            return {
              type: UNPUBLISHED_ENTRY_PERSIST_REQUEST,
              payload: {
                collection: collection.get('name'),
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 1 other location - About 1 hr to fix
          src/actions/editorialWorkflow.js on lines 107..116

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

          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

          function unpublishedEntryPublishRequest(collection, slug, transactionID) {
            return {
              type: UNPUBLISHED_ENTRY_PUBLISH_REQUEST,
              payload: { collection, slug },
              optimist: { type: BEGIN, id: transactionID },
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 2 other locations - About 50 mins to fix
          src/actions/editorialWorkflow.js on lines 152..158
          src/actions/editorialWorkflow.js on lines 168..174

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

          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

          function unpublishedEntryPublished(collection, slug, transactionID) {
            return {
              type: UNPUBLISHED_ENTRY_PUBLISH_SUCCESS,
              payload: { collection, slug },
              optimist: { type: COMMIT, id: transactionID },
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 2 other locations - About 50 mins to fix
          src/actions/editorialWorkflow.js on lines 152..158
          src/actions/editorialWorkflow.js on lines 160..166

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

          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

          function unpublishedEntryStatusChangeError(collection, slug, transactionID) {
            return {
              type: UNPUBLISHED_ENTRY_STATUS_CHANGE_FAILURE,
              payload: { collection, slug },
              optimist: { type: REVERT, id: transactionID },
          Severity: Major
          Found in src/actions/editorialWorkflow.js and 2 other locations - About 50 mins to fix
          src/actions/editorialWorkflow.js on lines 160..166
          src/actions/editorialWorkflow.js on lines 168..174

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

          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

          There are no issues that match your filters.

          Category
          Status