dopry/netlify-cms

View on GitHub

Showing 220 of 220 total issues

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

  describe('DRAFT_CREATE_EMPTY', () => {
    it('should create a new draft ', () => {
      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 24..44

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

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

        const filteredEntries = fuzzy.filter(searchTerm, collectionEntries, {
          extract: entry => searchFields.reduce((acc, field) => {
            const f = entry.data[field];
            return f ? `${ acc } ${ f }` : acc;
          }, ""),
Severity: Major
Found in src/actions/search.js and 1 other location - About 3 hrs to fix
src/actions/search.js on lines 201..206

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

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 filteredEntries = fuzzy.filter(searchTerm, entries, {
      extract: entry => searchFields.reduce((acc, field) => {
        const f = entry.data[field];
        return f ? `${ acc } ${ f }` : acc;
      }, ""),
Severity: Major
Found in src/actions/search.js and 1 other location - About 3 hrs to fix
src/actions/search.js on lines 157..162

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

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

  it('should disable and update label of Save button when persisting', () => {
    const component = shallow(
      <EntryEditorToolbar
        isPersisting
        onPersist={() => {}}
src/components/EntryEditor/__tests__/EntryEditorToolbar.spec.js on lines 18..29

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

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

  it('should enable the Save button', () => {
    const component = shallow(
      <EntryEditorToolbar
        enableSave
        onPersist={() => {}}
src/components/EntryEditor/__tests__/EntryEditorToolbar.spec.js on lines 31..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 97.

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

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

        describe('General', () => {
          it('should render markdown', () => {
            const value = `
    # H1
    
    
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 56..72
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 74..86
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 102..122

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

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

        describe('Lists', () => {
          it('should render lists', () => {
            const value = `
    1. ol item 1
    1. ol item 2
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 13..44
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 74..86
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 102..122

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

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

        describe('HTML', () => {
          it('should render HTML as is when using Markdown', () => {
            const value = `
    # Title
    
    
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 13..44
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 56..72
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 74..86

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

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

        describe('Links', () => {
          it('should render links', () => {
            const value = `
    I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3].
    
    
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 13..44
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 56..72
    src/components/Widgets/Markdown/MarkdownPreview/__tests__/renderer.spec.js on lines 102..122

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

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

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

                  <ScrollSyncPane>
                    <div style={paneStyle}>
                      <section style={{ height: 2000 }}>
                        <h1>Third Pane Content</h1>
                        <p>
          Severity: Major
          Found in src/components/stories/ScrollSync.js and 2 other locations - About 2 hrs to fix
          src/components/stories/ScrollSync.js on lines 15..26
          src/components/stories/ScrollSync.js on lines 28..39

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

          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

                  <ScrollSyncPane>
                    <div style={paneStyle}>
                      <section style={{ height: 10000 }}>
                        <h1>Right Pane Content</h1>
                        <p>
          Severity: Major
          Found in src/components/stories/ScrollSync.js and 2 other locations - About 2 hrs to fix
          src/components/stories/ScrollSync.js on lines 15..26
          src/components/stories/ScrollSync.js on lines 41..52

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

          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

            static propTypes = {
              plugin: PropTypes.object.isRequired,
              onSubmit: PropTypes.func.isRequired,
              onCancel: PropTypes.func.isRequired,
              onAddAsset: PropTypes.func.isRequired,
          src/components/AppHeader/AppHeader.js on lines 15..22

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

          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

                  <ScrollSyncPane>
                    <div style={paneStyle}>
                      <section style={{ height: 5000 }}>
                        <h1>Left Pane Content</h1>
                        <p>
          Severity: Major
          Found in src/components/stories/ScrollSync.js and 2 other locations - About 2 hrs to fix
          src/components/stories/ScrollSync.js on lines 28..39
          src/components/stories/ScrollSync.js on lines 41..52

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

          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

            static propTypes = {
              user: ImmutablePropTypes.map.isRequired,
              collections: ImmutablePropTypes.orderedMap.isRequired,
              runCommand: PropTypes.func.isRequired,
              toggleDrawer: PropTypes.func.isRequired,
          Severity: Major
          Found in src/components/AppHeader/AppHeader.js and 1 other location - About 2 hrs to fix
          src/components/Widgets/Markdown/MarkdownControl/Toolbar/ToolbarPluginForm.js on lines 9..16

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

          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 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
            Severity
            Category
            Status
            Source
            Language