dopry/netlify-cms

View on GitHub

Showing 110 of 220 total issues

File API.js has 496 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import LocalForage from "localforage";
import { Base64 } from "js-base64";
import _ from "lodash";
import { filterPromises, resolvePromiseProperties } from "../../lib/promiseHelper";
import AssetProxy from "../../valueObjects/AssetProxy";
Severity: Minor
Found in src/backends/github/API.js - About 7 hrs to fix

    API has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class API {
      constructor(config) {
        this.api_root = config.api_root || "https://api.github.com";
        this.token = config.token || false;
        this.branch = config.branch || "master";
    Severity: Minor
    Found in src/backends/github/API.js - About 5 hrs to fix

      Function localSearch has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

      function localSearch(searchTerm, getState, dispatch) {
        return (function acc(localResults = { entries: [] }) {
          function processCollection(collection, collectionKey) {
            const state = getState();
            if (state.entries.hasIn(['pages', collectionKey, 'ids'])) {
      Severity: Minor
      Found in src/actions/search.js - About 4 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

      File Icon.js has 327 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react';
      import { Icon } from '../UI';
      import { storiesOf } from '@kadira/storybook';
      
      const style = {
      Severity: Minor
      Found in src/components/stories/Icon.js - About 3 hrs to fix

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

          render() {
            const {
                collection,
                entry,
                fields,
        Severity: Major
        Found in src/components/EntryEditor/EntryEditor.js - About 3 hrs to fix

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

            render() {
              const {
                user,
                config,
                children,
          Severity: Major
          Found in src/containers/App.js - About 3 hrs to fix

            Function remarkPaddedLinks has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function remarkPaddedLinks() {
            
              function transform(node) {
            
                /**
            Severity: Minor
            Found in src/components/Widgets/Markdown/serializers/remarkPaddedLinks.js - About 2 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 editorialWorkflowGit has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              editorialWorkflowGit(fileTree, entry, filesList, options) {
                const contentKey = entry.slug;
                const branchName = `cms/${ contentKey }`;
                const unpublished = options.unpublished || false;
                if (!unpublished) {
            Severity: Major
            Found in src/backends/github/API.js - About 2 hrs to fix

              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

                File entries.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { List } from 'immutable';
                import { actions as notifActions } from 'redux-notifications';
                import { serializeValues } from '../lib/serializeEntryValues';
                import { closeEntry } from './editor';
                import { currentBackend } from '../backends/backend';
                Severity: Minor
                Found in src/actions/entries.js - About 2 hrs to fix

                  Function convertNode has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function convertNode(node, nodes) {
                  
                    /**
                     * Unified/Remark processors use mutable operations, so we don't want to
                     * change a node's type directly for conversion purposes, as that tends to
                  Severity: Major
                  Found in src/components/Widgets/Markdown/serializers/remarkSlate.js - About 2 hrs to fix

                    File backend.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { attempt, isError } from 'lodash';
                    import TestRepoBackend from "./test-repo/implementation";
                    import GitHubBackend from "./github/implementation";
                    import GitGatewayBackend from "./git-gateway/implementation";
                    import { resolveFormat } from "../formats/formats";
                    Severity: Minor
                    Found in src/backends/backend.js - About 2 hrs to fix

                      Function entryDraftReducer has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const entryDraftReducer = (state = Map(), action) => {
                        switch (action.type) {
                          case DRAFT_CREATE_FROM_ENTRY:
                            // Existing Entry
                            return state.withMutations((state) => {
                      Severity: Major
                      Found in src/reducers/entryDraft.js - About 2 hrs to fix

                        Function onKeyDown has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function onKeyDown(e, data, state) {
                          const createDefaultBlock = () => {
                            return Block.create({
                              type: 'paragraph',
                              nodes: [Text.createFromString('')]
                        Severity: Minor
                        Found in src/components/Widgets/Markdown/MarkdownControl/VisualEditor/keys.js - About 2 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 render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          render() {
                            const {
                              onToggleMode,
                              rawMode,
                              plugins,
                        Severity: Major
                        Found in src/components/Widgets/Markdown/MarkdownControl/Toolbar/Toolbar.js - About 2 hrs to fix

                          Function unpublishedEntries has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const unpublishedEntries = (state = null, action) => {
                            const publishMode = action.payload && action.payload.publish_mode;
                            switch (action.type) {
                              case CONFIG_SUCCESS:
                                if (publishMode === EDITORIAL_WORKFLOW) {
                          Severity: Minor
                          Found in src/reducers/editorialWorkflow.js - About 1 hr to fix

                            Function SoftBreak has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const SoftBreak = (options = {}) => ({
                              onKeyDown(e, data, state) {
                                if (data.key != 'enter') return;
                                if (options.shift && e.shiftKey == false) return;
                            
                            

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

                            function inferWidget(name, value) {
                              if (value == null) {
                                return { widget: 'string' };
                              }
                              if (value instanceof Date) {
                            Severity: Minor
                            Found in scripts/autoconfigure.collection.js - About 1 hr 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 convertNode has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function convertNode(node, children, shortcodePlugins) {
                              switch (node.type) {
                            
                                /**
                                 * General
                            Severity: Minor
                            Found in src/components/Widgets/Markdown/serializers/slateRemark.js - About 1 hr to fix

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

                                render() {
                                  const { errors } = this.state;
                                  const { error } = this.props;
                              
                                  if (window.netlifyIdentity) {
                              Severity: Minor
                              Found in src/backends/git-gateway/AuthenticationPage.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language