ckeditor/ckeditor5-engine

View on GitHub

Showing 564 of 564 total issues

Selection has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Selection {
    /**
     * Creates a new selection instance based on the given {@link module:engine/model/selection~Selectable selectable}
     * or creates an empty selection if no arguments were passed.
     *
Severity: Minor
Found in src/model/selection.js - About 3 hrs to fix

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

    ClassicEditor
        .create( document.querySelector( '#snippet-link-unsafe-classes' ), {
            cloudServices: CS_CONFIG,
            extraPlugins: [ AddClassToUnsafeLinks ],
            toolbar: {
    docs/_snippets/framework/extending-content-add-external-link-target.js on lines 34..47
    docs/_snippets/framework/extending-content-add-heading-class.js on lines 20..33
    docs/_snippets/framework/extending-content-add-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-allow-div-attributes.js on lines 61..74
    docs/_snippets/framework/extending-content-custom-figure-attributes.js on lines 173..186

    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

        elementToElement( definition ) {
            // Set up downcast converter.
            this.for( 'downcast' ).elementToElement( definition );
    
            // Set up upcast converter.
    Severity: Major
    Found in src/conversion/conversion.js and 1 other location - About 3 hrs to fix
    src/conversion/conversion.js on lines 435..448

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

    ClassicEditor
        .create( document.querySelector( '#snippet-link-external' ), {
            cloudServices: CS_CONFIG,
            extraPlugins: [ AddTargetToExternalLinks ],
            toolbar: {
    docs/_snippets/framework/extending-content-add-heading-class.js on lines 20..33
    docs/_snippets/framework/extending-content-add-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-add-unsafe-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-allow-div-attributes.js on lines 61..74
    docs/_snippets/framework/extending-content-custom-figure-attributes.js on lines 173..186

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

    ClassicEditor
        .create( document.querySelector( '#snippet-custom-figure-attributes' ), {
            cloudServices: CS_CONFIG,
            extraPlugins: [ CustomFigureAttributes ],
            toolbar: {
    docs/_snippets/framework/extending-content-add-external-link-target.js on lines 34..47
    docs/_snippets/framework/extending-content-add-heading-class.js on lines 20..33
    docs/_snippets/framework/extending-content-add-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-add-unsafe-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-allow-div-attributes.js on lines 61..74

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

    ClassicEditor
        .create( document.querySelector( '#snippet-heading-class' ), {
            cloudServices: CS_CONFIG,
            extraPlugins: [ AddClassToAllHeading1 ],
            toolbar: {
    docs/_snippets/framework/extending-content-add-external-link-target.js on lines 34..47
    docs/_snippets/framework/extending-content-add-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-add-unsafe-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-allow-div-attributes.js on lines 61..74
    docs/_snippets/framework/extending-content-custom-figure-attributes.js on lines 173..186

    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

        attributeToElement( definition ) {
            // Set up downcast converter.
            this.for( 'downcast' ).attributeToElement( definition );
    
            // Set up upcast converter.
    Severity: Major
    Found in src/conversion/conversion.js and 1 other location - About 3 hrs to fix
    src/conversion/conversion.js on lines 263..276

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

    ClassicEditor
        .create( document.querySelector( '#snippet-link-classes' ), {
            cloudServices: CS_CONFIG,
            extraPlugins: [ AddClassToAllLinks ],
            toolbar: {
    docs/_snippets/framework/extending-content-add-external-link-target.js on lines 34..47
    docs/_snippets/framework/extending-content-add-heading-class.js on lines 20..33
    docs/_snippets/framework/extending-content-add-unsafe-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-allow-div-attributes.js on lines 61..74
    docs/_snippets/framework/extending-content-custom-figure-attributes.js on lines 173..186

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

    ClassicEditor
        .create( document.querySelector( '#snippet-div-attributes' ), {
            cloudServices: CS_CONFIG,
            extraPlugins: [ ConvertDivAttributes ],
            toolbar: {
    docs/_snippets/framework/extending-content-add-external-link-target.js on lines 34..47
    docs/_snippets/framework/extending-content-add-heading-class.js on lines 20..33
    docs/_snippets/framework/extending-content-add-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-add-unsafe-link-class.js on lines 30..43
    docs/_snippets/framework/extending-content-custom-figure-attributes.js on lines 173..186

    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

    File element.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
     * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
     */
    
    
    Severity: Minor
    Found in src/view/element.js - About 3 hrs to fix

      Function _wrapAttributeElement has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          _wrapAttributeElement( wrapper, toWrap ) {
              if ( !canBeJoined( wrapper, toWrap ) ) {
                  return false;
              }
      
      
      Severity: Minor
      Found in src/view/downcastwriter.js - About 3 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 jumpOverUiElement has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      function jumpOverUiElement( evt, data, domConverter ) {
          if ( data.keyCode == keyCodes.arrowright ) {
              const domSelection = data.domTarget.ownerDocument.defaultView.getSelection();
              const domSelectionCollapsed = domSelection.rangeCount == 1 && domSelection.getRangeAt( 0 ).collapsed;
      
      
      Severity: Minor
      Found in src/view/uielement.js - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      File selection.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
       * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
       */
      
      
      Severity: Minor
      Found in src/model/selection.js - About 3 hrs to fix

        LiveSelection has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class LiveSelection extends Selection {
            // Creates an empty live selection for given {@link module:engine/model/document~Document}.
            // @param {module:engine/model/document~Document} doc Document which owns this selection.
            constructor( doc ) {
                super();
        Severity: Minor
        Found in src/model/documentselection.js - About 3 hrs to fix

          Schema has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default class Schema {
              /**
               * Creates schema instance.
               */
              constructor() {
          Severity: Minor
          Found in src/model/schema.js - About 3 hrs to fix

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

                getCommonAncestor( position ) {
                    const ancestorsA = this.getAncestors();
                    const ancestorsB = position.getAncestors();
            
                    let i = 0;
            Severity: Major
            Found in src/view/position.js and 1 other location - About 3 hrs to fix
            src/model/position.js on lines 386..397

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

            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

                getCommonAncestor( position ) {
                    const ancestorsA = this.getAncestors();
                    const ancestorsB = position.getAncestors();
            
                    let i = 0;
            Severity: Major
            Found in src/model/position.js and 1 other location - About 3 hrs to fix
            src/view/position.js on lines 196..207

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

            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 _onMutations has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _onMutations( domMutations ) {
                    // As a result of this.flush() we can have an empty collection.
                    if ( domMutations.length === 0 ) {
                        return;
                    }
            Severity: Major
            Found in src/view/observer/mutationobserver.js - About 3 hrs to fix

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

                  getAncestors( options = { includeSelf: false, parentFirst: false } ) {
                      const ancestors = [];
                      let parent = options.includeSelf ? this : this.parent;
              
                      while ( parent ) {
              Severity: Major
              Found in src/model/node.js and 2 other locations - About 3 hrs to fix
              src/model/textproxy.js on lines 209..219
              src/view/node.js on lines 167..177

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

              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

                  getAncestors( options = { includeSelf: false, parentFirst: false } ) {
                      const ancestors = [];
                      let parent = options.includeSelf ? this : this.parent;
              
                      while ( parent ) {
              Severity: Major
              Found in src/view/node.js and 2 other locations - About 3 hrs to fix
              src/model/node.js on lines 236..246
              src/model/textproxy.js on lines 209..219

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

              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