superdesk/superdesk-client-core

View on GitHub
scripts/core/editor3/reducers/suggestions.tsx

Summary

Maintainability
F
1 wk
Test Coverage

File suggestions.tsx has 730 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {EditorState, Modifier, RichUtils} from 'draft-js';
import {onChange} from './editor3';
import {acceptedInlineStyles, sanitizeContent} from '../helpers/inlineStyles';
import {
    changeSuggestionsTypes, getStyleSuggestionsTypes,
Severity: Major
Found in scripts/core/editor3/reducers/suggestions.tsx - About 1 day to fix

    Function applyChangeSuggestion has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const applyChangeSuggestion = (editorState, accepted) => {
        const suggestionTypes = [...changeSuggestionsTypes, ...paragraphSuggestionTypes];
        let selection = editorState.getSelection();
        let content = editorState.getCurrentContent();
        let lastBlock = content.getBlockForKey(selection.getEndKey());
    Severity: Major
    Found in scripts/core/editor3/reducers/suggestions.tsx - About 2 hrs to fix

      Function applyChangeSuggestion has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      const applyChangeSuggestion = (editorState, accepted) => {
          const suggestionTypes = [...changeSuggestionsTypes, ...paragraphSuggestionTypes];
          let selection = editorState.getSelection();
          let content = editorState.getCurrentContent();
          let lastBlock = content.getBlockForKey(selection.getEndKey());
      Severity: Minor
      Found in scripts/core/editor3/reducers/suggestions.tsx - 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 processSuggestion has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      const processSuggestion = (state, {data, suggestion}, accepted) => {
          if (accepted === true || accepted === false) {
              // after clicking accept/reject editor focus is lost
              // restore the focus so undo stack is correct
              // and pop up can be positioned properly on undo SDFID-401
      Severity: Minor
      Found in scripts/core/editor3/reducers/suggestions.tsx - 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 applyStyleSuggestion has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      function applyStyleSuggestion(editorState, type, style, data) {
          const selection = editorState.getSelection();
          let newEditorState = editorState;
          let tmpEditorState;
          let currentStyle;
      Severity: Minor
      Found in scripts/core/editor3/reducers/suggestions.tsx - 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 removeDeleteParagraphSuggestions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      const removeDeleteParagraphSuggestions = (editorState) => {
          const selection = editorState.getSelection();
          let content = editorState.getCurrentContent();
          let block = content.getBlockForKey(selection.getStartKey());
          let offset = 0;
      Severity: Minor
      Found in scripts/core/editor3/reducers/suggestions.tsx - 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 removeDeleteParagraphSuggestions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const removeDeleteParagraphSuggestions = (editorState) => {
          const selection = editorState.getSelection();
          let content = editorState.getCurrentContent();
          let block = content.getBlockForKey(selection.getStartKey());
          let offset = 0;
      Severity: Minor
      Found in scripts/core/editor3/reducers/suggestions.tsx - About 1 hr to fix

        Function applyStyleSuggestion has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function applyStyleSuggestion(editorState, type, style, data) {
            const selection = editorState.getSelection();
            let newEditorState = editorState;
            let tmpEditorState;
            let currentStyle;
        Severity: Minor
        Found in scripts/core/editor3/reducers/suggestions.tsx - About 1 hr to fix

          Function addDeleteParagraphSuggestions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const addDeleteParagraphSuggestions = (editorState, data) => {
              const selection = editorState.getSelection();
              let newEditorState = editorState;
              let content = editorState.getCurrentContent();
              let block = content.getBlockForKey(selection.getStartKey());
          Severity: Minor
          Found in scripts/core/editor3/reducers/suggestions.tsx - About 1 hr to fix

            Function deleteCurrentSelection has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            const deleteCurrentSelection = (editorState, data, action = 'delete') => {
                let selection = editorState.getSelection();
                let newEditorState;
            
                if (selection.isCollapsed()) {
            Severity: Minor
            Found in scripts/core/editor3/reducers/suggestions.tsx - 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 deleteCurrentSelection has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const deleteCurrentSelection = (editorState, data, action = 'delete') => {
                let selection = editorState.getSelection();
                let newEditorState;
            
                if (selection.isCollapsed()) {
            Severity: Minor
            Found in scripts/core/editor3/reducers/suggestions.tsx - About 1 hr to fix

              Function setDeleteSuggestionForCharacter has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const setDeleteSuggestionForCharacter = (editorState, data) => {
                  const selection = editorState.getSelection();
              
                  const paragraphStyle = Highlights.getHighlightStyleAtOffset(editorState, paragraphSuggestionTypes, selection, -1);
              
              
              Severity: Minor
              Found in scripts/core/editor3/reducers/suggestions.tsx - About 1 hr to fix

                Function suggestions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const suggestions = (state = {}, action) => {
                    switch (action.type) {
                    case 'TOGGLE_SUGGESTING_MODE':
                        return toggleSuggestingMode(state);
                    case 'CREATE_ADD_SUGGESTION':
                Severity: Minor
                Found in scripts/core/editor3/reducers/suggestions.tsx - About 1 hr to fix

                  Function setDeleteSuggestionForCharacter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const setDeleteSuggestionForCharacter = (editorState, data) => {
                      const selection = editorState.getSelection();
                  
                      const paragraphStyle = Highlights.getHighlightStyleAtOffset(editorState, paragraphSuggestionTypes, selection, -1);
                  
                  
                  Severity: Minor
                  Found in scripts/core/editor3/reducers/suggestions.tsx - 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 addDeleteParagraphSuggestions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const addDeleteParagraphSuggestions = (editorState, data) => {
                      const selection = editorState.getSelection();
                      let newEditorState = editorState;
                      let content = editorState.getCurrentContent();
                      let block = content.getBlockForKey(selection.getStartKey());
                  Severity: Minor
                  Found in scripts/core/editor3/reducers/suggestions.tsx - About 55 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

                  Function setAddSuggestionForCharacter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const setAddSuggestionForCharacter = (editorState, data, text, inlineStyle = null) => {
                      const crtInlineStyle = inlineStyle || editorState.getCurrentInlineStyle();
                      const selection = editorState.getSelection();
                      const beforeStyle =
                          Highlights.getHighlightStyleAtOffset(editorState, changeSuggestionsTypes, selection, -1) as string;
                  Severity: Minor
                  Found in scripts/core/editor3/reducers/suggestions.tsx - 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

                  Avoid too many return statements within this function.
                  Open

                          return saveEditorStatus(state, editorState, 'apply-entity', true);
                  Severity: Major
                  Found in scripts/core/editor3/reducers/suggestions.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return Highlights.changeEditorSelection(newEditorState, 1, 1, false);
                    Severity: Major
                    Found in scripts/core/editor3/reducers/suggestions.tsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return saveEditorStatus(state, editorState, 'change-block-data');
                      Severity: Major
                      Found in scripts/core/editor3/reducers/suggestions.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return saveEditorStatus(state, editorState, 'change-inline-style', true);
                        Severity: Major
                        Found in scripts/core/editor3/reducers/suggestions.tsx - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return EditorState.acceptSelection(newEditorState, selection);
                          Severity: Major
                          Found in scripts/core/editor3/reducers/suggestions.tsx - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return saveEditorStatus(state, editorState, 'change-inline-style', true);
                            Severity: Major
                            Found in scripts/core/editor3/reducers/suggestions.tsx - About 30 mins to fix

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

                              const createSplitParagraphSuggestion = (state, {data}) => {
                                  const type = 'SPLIT_PARAGRAPH_SUGGESTION';
                                  let {editorState} = state;
                                  const isMergeParagraphAfter = isMergeParagraph(editorState, data);
                                  const checkState = Highlights.changeEditorSelection(editorState, -1, -1, false);
                              Severity: Minor
                              Found in scripts/core/editor3/reducers/suggestions.tsx - 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

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

                                  if (beforeData != null && beforeData.type === 'ADD_SUGGESTION'
                                      && beforeData.author === data.author) {
                                      // if previous character is an add suggestion of the same user, set the same data
                                      newState = RichUtils.toggleInlineStyle(newState, beforeStyle);
                                  } else if (currentData != null && currentData.type === 'ADD_SUGGESTION'
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 5 hrs to fix
                              scripts/core/editor3/reducers/suggestions.tsx on lines 1089..1100

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

                              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 (beforeData != null && beforeData.type === 'DELETE_SUGGESTION'
                                      && beforeData.author === data.author) {
                                      // if previous character is a delete suggestion of the same user, set the same data
                                      newState = RichUtils.toggleInlineStyle(newState, beforeStyle);
                                  } else if (afterData != null && afterData.type === 'DELETE_SUGGESTION'
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 5 hrs to fix
                              scripts/core/editor3/reducers/suggestions.tsx on lines 972..983

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

                              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 isMergeParagraph = (editorState, data) => {
                                  const suggestionStyle = Highlights.getHighlightStyleAtCurrentPosition(editorState, ['MERGE_PARAGRAPHS_SUGGESTION']);
                              
                                  if (suggestionStyle == null) {
                                      return false;
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 2 hrs to fix
                              scripts/core/editor3/reducers/suggestions.tsx on lines 998..1008

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

                              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 isSplitParagraph = (editorState, data) => {
                                  const suggestionStyle = Highlights.getHighlightStyleAtCurrentPosition(editorState, ['SPLIT_PARAGRAPH_SUGGESTION']);
                              
                                  if (suggestionStyle == null) {
                                      return false;
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 2 hrs to fix
                              scripts/core/editor3/reducers/suggestions.tsx on lines 313..323

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

                              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 newSelection = selection.merge({
                                      anchorKey: selection.getStartKey(),
                                      anchorOffset: selection.getStartOffset(),
                                      focusKey: finalSelection.getStartKey(),
                                      focusOffset: finalSelection.getStartOffset(),
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 1 hr to fix
                              scripts/core/editor3/reducers/toolbar.tsx on lines 224..231

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

                              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 blocksSelection = selection.merge({
                                      anchorOffset: 0,
                                      anchorKey: firstBlock.getKey(),
                                      focusOffset: lastBlock.getLength(),
                                      focusKey: lastBlock.getKey(),
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 1 hr to fix
                              scripts/core/editor3/helpers/suggestions.ts on lines 42..48

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

                              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 newSelection = selection.merge({
                                              anchorOffset: 0,
                                              anchorKey: block.getKey(),
                                              focusOffset: 0,
                                              focusKey: block.getKey(),
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 1 hr to fix
                              scripts/core/editor3/reducers/suggestions.tsx on lines 847..853

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

                              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

                                          selection = selection.merge({
                                              anchorOffset: 0,
                                              anchorKey: secondBlock.getKey(),
                                              focusOffset: 1,
                                              focusKey: secondBlock.getKey(),
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 1 hr to fix
                              scripts/core/editor3/reducers/suggestions.tsx on lines 379..385

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

                              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 newSelection = selection.merge({
                                              anchorOffset: 0,
                                              anchorKey: block.getKey(),
                                              focusOffset: 1,
                                              focusKey: block.getKey(),
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 1 hr to fix
                              scripts/core/editor3/reducers/suggestions.tsx on lines 787..793

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

                              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

                                  selection = selection.merge({
                                      anchorOffset: 0,
                                      anchorKey: secondBlock.getKey(),
                                      focusOffset: 0,
                                      focusKey: secondBlock.getKey(),
                              Severity: Major
                              Found in scripts/core/editor3/reducers/suggestions.tsx and 1 other location - About 1 hr to fix
                              scripts/core/editor3/reducers/suggestions.tsx on lines 354..360

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

                              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