dopry/netlify-cms

View on GitHub

Showing 220 of 220 total issues

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

describe('fileExtension', () => {
  it('should return the extension of a file', () => {
    expect(
      fileExtension('index.html')
    ).toEqual(
Severity: Major
Found in src/lib/__tests__/pathHelper.spec.js and 1 other location - About 1 day to fix
src/lib/__tests__/pathHelper.spec.js on lines 3..51

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

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

describe('fileExtensionWithSeparator', () => {
  it('should return the extension of a file', () => {
    expect(
      fileExtensionWithSeparator('index.html')
    ).toEqual(
Severity: Major
Found in src/lib/__tests__/pathHelper.spec.js and 1 other location - About 1 day to fix
src/lib/__tests__/pathHelper.spec.js on lines 53..101

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

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

    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

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

      request(path, options = {}) {
        const headers = this.requestHeaders(options.headers || {});
        const url = this.urlFor(path, options);
        return fetch(url, { ...options, headers }).then((response) => {
          const contentType = response.headers.get('Content-Type');
    Severity: Major
    Found in src/integrations/providers/algolia/implementation.js and 1 other location - About 5 hrs to fix
    src/integrations/providers/assetStore/implementation.js on lines 56..67

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

    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 2 locations. Consider refactoring.
    Open

      request(path, options = {}) {
        const headers = this.requestHeaders(options.headers || {});
        const url = this.urlFor(path, options);
        return fetch(url, { ...options, headers }).then((response) => {
          const contentType = response.headers.get('Content-Type');
    Severity: Major
    Found in src/integrations/providers/assetStore/implementation.js and 1 other location - About 5 hrs to fix
    src/integrations/providers/algolia/implementation.js on lines 64..75

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

    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

    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

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

        urlFor(path, options) {
          const params = [];
          if (options.params) {
            for (const key in options.params) {
              params.push(`${ key }=${ encodeURIComponent(options.params[key]) }`);
      Severity: Major
      Found in src/integrations/providers/algolia/implementation.js and 1 other location - About 4 hrs to fix
      src/integrations/providers/assetStore/implementation.js on lines 23..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 120.

      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 2 locations. Consider refactoring.
      Open

        urlFor(path, options) {
          const params = [];
          if (options.params) {
            for (const key in options.params) {
              params.push(`${ key }=${ encodeURIComponent(options.params[key]) }`);
      Severity: Major
      Found in src/integrations/providers/assetStore/implementation.js and 1 other location - About 4 hrs to fix
      src/integrations/providers/algolia/implementation.js on lines 51..62

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

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

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

            const output = u('root', [
              u('paragraph', [ u('text', 'Paragraph text.') ]),
              u('heading', { depth: 1 }, [ u('text', 'Heading text.') ]),
              u('code', 'someCode()'),
              u('blockquote', [ u('text', 'Quote text.') ]),
        src/components/Widgets/Markdown/serializers/__tests__/remarkAssertParents.spec.js on lines 9..17

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

        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

              u('paragraph', [
                u('paragraph', [ u('text', 'Paragraph text.') ]),
                u('heading', { depth: 1 }, [ u('text', 'Heading text.') ]),
                u('code', 'someCode()'),
                u('blockquote', [ u('text', 'Quote text.') ]),
        src/components/Widgets/Markdown/serializers/__tests__/remarkAssertParents.spec.js on lines 20..28

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

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

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

              it('should remove blocks that are emptied as a result of denesting', () => {
                const input = u('root', [
                  u('paragraph', [
                    u('heading', { depth: 1 }, [ u('text', 'Heading text.') ]),
                  ]),
            src/components/Widgets/Markdown/serializers/__tests__/remarkAssertParents.spec.js on lines 75..87
            src/components/Widgets/Markdown/serializers/__tests__/remarkAssertParents.spec.js on lines 103..115

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

            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 handle assymetrical splits', () => {
                const input = u('root', [
                  u('paragraph', [
                    u('heading', { depth: 1 }, [ u('text', 'Heading text.') ]),
                  ]),
            src/components/Widgets/Markdown/serializers/__tests__/remarkAssertParents.spec.js on lines 75..87
            src/components/Widgets/Markdown/serializers/__tests__/remarkAssertParents.spec.js on lines 89..101

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

            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 remove blocks that are emptied as a result of denesting', () => {
                const input = u('root', [
                  u('paragraph', [
                    u('heading', { depth: 1 }, [ u('text', 'Heading text.') ]),
                  ]),
            src/components/Widgets/Markdown/serializers/__tests__/remarkAssertParents.spec.js on lines 89..101
            src/components/Widgets/Markdown/serializers/__tests__/remarkAssertParents.spec.js on lines 103..115

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

            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

              describe('DRAFT_CREATE_FROM_ENTRY', () => {
                it('should create draft from the entry', () => {
                  expect(
                    reducer(
                      initialState,
            Severity: Major
            Found in src/reducers/__tests__/entryDraft.spec.js and 1 other location - About 3 hrs to fix
            src/reducers/__tests__/entryDraft.spec.js on lines 46..66

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

            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