ckeditor/ckeditor5-list

View on GitHub

Showing 30 of 30 total issues

Function _checkEnabled has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    _checkEnabled() {
        // Check whether any of position's ancestor is a list item.
        const listItem = first( this.editor.model.document.selection.getSelectedBlocks() );

        // If selection is not in a list item, the command is disabled.
Severity: Minor
Found in src/indentcommand.js - 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 viewModelConverter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function viewModelConverter( evt, data, conversionApi ) {
    if ( conversionApi.consumable.consume( data.viewItem, { name: true } ) ) {
        const writer = conversionApi.writer;

        // 1. Create `listItem` model element.
Severity: Minor
Found in src/converters.js - About 45 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 hoistNestedLists has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function hoistNestedLists( nextIndent, modelRemoveStartPosition, viewRemoveStartPosition, viewRemovedItem, conversionApi, model ) {
Severity: Minor
Found in src/converters.js - About 45 mins to fix

    Function getViewListItemLength has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function getViewListItemLength( element ) {
        let length = 1;
    
        for ( const child of element.getChildren() ) {
            if ( child.name == 'ul' || child.name == 'ol' ) {
    Severity: Minor
    Found in src/listediting.js - About 45 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 getIndent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function getIndent( listItem ) {
        let indent = 0;
    
        let parent = listItem.parent;
    
    
    Severity: Minor
    Found in src/converters.js - About 45 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 deeply nested control flow statements.
    Open

                        if ( mergePos && mergePos.parent == previousList ) {
                            viewPosition.offset--;
                        }
    Severity: Major
    Found in src/converters.js - About 45 mins to fix

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

      function hoistNestedLists( nextIndent, modelRemoveStartPosition, viewRemoveStartPosition, viewRemovedItem, conversionApi, model ) {
          // Find correct previous model list item element.
          // The element has to have either same or smaller indent than given reference indent.
          // This will be the model element which will get nested items (if it has smaller indent) or sibling items (if it has same indent).
          // Keep in mind that such element might not be found, if removed item was the first item.
      Severity: Minor
      Found in src/converters.js - 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

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

      export function cleanList( evt, data, conversionApi ) {
          if ( conversionApi.consumable.test( data.viewItem, { name: true } ) ) {
              // Caching children because when we start removing them iterating fails.
              const children = Array.from( data.viewItem.getChildren() );
      
      
      Severity: Minor
      Found in src/converters.js - 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;
      Severity: Major
      Found in src/listediting.js - About 30 mins to fix

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

        export function getSiblingListItem( modelItem, options ) {
            const sameIndent = !!options.sameIndent;
            const smallerIndent = !!options.smallerIndent;
            const indent = options.listIndent;
        
        
        Severity: Minor
        Found in src/utils.js - 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

        Severity
        Category
        Status
        Source
        Language