ckeditor/ckeditor5-engine

View on GitHub

Showing 564 of 564 total issues

Function _getTouchingInlineDomNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _getTouchingInlineDomNode( node, getNext ) {
        if ( !node.parentNode ) {
            return null;
        }

Severity: Minor
Found in src/view/domconverter.js - About 1 hr to fix

    Function highlightText has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function highlightText( highlightDescriptor ) {
        return ( evt, data, conversionApi ) => {
            if ( !data.item ) {
                return;
            }
    Severity: Minor
    Found in src/conversion/downcasthelpers.js - About 1 hr to fix

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

          static _createFromPositionAndShift( position, shift ) {
              const start = position;
              const end = position.getShiftedBy( shift );
      
              return shift > 0 ? new this( start, end ) : new this( end, start );
      Severity: Major
      Found in src/view/range.js and 1 other location - About 1 hr to fix
      src/model/range.js on lines 866..871

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

      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

          getLastMatchingPosition( skip, options = {} ) {
              options.startPosition = this;
      
              const treeWalker = new TreeWalker( options );
              treeWalker.skip( skip );
      Severity: Major
      Found in src/view/position.js and 1 other location - About 1 hr to fix
      src/model/position.js on lines 321..328

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

      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

          _getRemoveDiff( parent, offset, name ) {
              return {
                  type: 'remove',
                  position: Position._createAt( parent, offset ),
                  name,
      Severity: Major
      Found in src/model/differ.js and 1 other location - About 1 hr to fix
      src/model/differ.js on lines 898..906

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

      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 _createFromPositionAndShift( position, shift ) {
              const start = position;
              const end = position.getShiftedBy( shift );
      
              return shift > 0 ? new this( start, end ) : new this( end, start );
      Severity: Major
      Found in src/model/range.js and 1 other location - About 1 hr to fix
      src/view/range.js on lines 493..498

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

      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

          _getInsertDiff( parent, offset, name ) {
              return {
                  type: 'insert',
                  position: Position._createAt( parent, offset ),
                  name,
      Severity: Major
      Found in src/model/differ.js and 1 other location - About 1 hr to fix
      src/model/differ.js on lines 917..925

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

      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

          getLastMatchingPosition( skip, options = {} ) {
              options.startPosition = this;
      
              const treeWalker = new TreeWalker( options );
              treeWalker.skip( skip );
      Severity: Major
      Found in src/model/position.js and 1 other location - About 1 hr to fix
      src/view/position.js on lines 167..174

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

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

      function isElementMatching( element, pattern ) {
          // If pattern is provided as function - return result of that function;
          if ( typeof pattern == 'function' ) {
              return pattern( element );
          }
      Severity: Minor
      Found in src/view/matcher.js - About 1 hr to fix

        Function split has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            split( position, limitElement ) {
                this._assertWriterUsedCorrectly();
        
                let splitElement = position.parent;
        
        
        Severity: Minor
        Found in src/model/writer.js - About 1 hr to fix

          Function getNearestSelectionRange has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getNearestSelectionRange( position, direction = 'both' ) {
                  // Return collapsed range if provided position is valid.
                  if ( this.checkChild( position, '$text' ) ) {
                      return new Range( position );
                  }
          Severity: Minor
          Found in src/model/schema.js - About 1 hr to fix

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

                mergeAttributes( position ) {
                    const positionOffset = position.offset;
                    const positionParent = position.parent;
            
                    // When inside text node - nothing to merge.
            Severity: Minor
            Found in src/view/downcastwriter.js - About 1 hr to fix

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

                  _handleSelectionChange( domDocument ) {
                      if ( !this.isEnabled ) {
                          return;
                      }
              
              
              Severity: Minor
              Found in src/view/observer/selectionobserver.js - About 1 hr to fix

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

                    _formatReturnValue( type, item, previousPosition, nextPosition, length ) {
                        // Text is a specific parent, because contains string instead of children.
                        // Walker doesn't enter to the Text except situations when walker is iterating over every single character,
                        // or the bound starts/ends inside the Text. So when the position is at the beginning or at the end of the Text
                        // we move it just before or just after Text.
                Severity: Minor
                Found in src/view/treewalker.js - About 1 hr to fix

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

                      clear( range, element ) {
                          validateRangeContainer( range, this.document );
                  
                          // Create walker on given range.
                          // We walk backward because when we remove element during walk it modifies range end position.
                  Severity: Minor
                  Found in src/view/downcastwriter.js - About 1 hr to fix

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

                        _updateAttributes( clearAll ) {
                            const newAttributes = toMap( this._getSurroundingAttributes() );
                            const oldAttributes = toMap( this.getAttributes() );
                    
                            if ( clearAll ) {
                    Severity: Minor
                    Found in src/model/documentselection.js - About 1 hr to fix

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

                          constructor( options = {} ) {
                              if ( !options.boundaries && !options.startPosition ) {
                                  /**
                                   * Neither boundaries nor starting position of a `TreeWalker` have been defined.
                                   *
                      Severity: Minor
                      Found in src/model/treewalker.js - About 1 hr to fix

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

                        export default function deleteContent( model, selection, options = {} ) {
                            if ( selection.isCollapsed ) {
                                return;
                            }
                        
                        
                        Severity: Minor
                        Found in src/model/utils/deletecontent.js - About 1 hr to fix

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

                              if ( viewElementDefinition.styles ) {
                                  const keys = Object.keys( viewElementDefinition.styles );
                          
                                  for ( const key of keys ) {
                                      viewWriter.setStyle( key, viewElementDefinition.styles[ key ], element );
                          Severity: Major
                          Found in src/conversion/downcasthelpers.js and 1 other location - About 1 hr to fix
                          src/conversion/downcasthelpers.js on lines 874..882

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

                          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

                                      } else if ( newAttribute.key == 'style' ) {
                                          const keys = Object.keys( newAttribute.value );
                          
                                          for ( const key of keys ) {
                                              viewWriter.setStyle( key, newAttribute.value[ key ], viewElement );
                          Severity: Major
                          Found in src/conversion/downcasthelpers.js and 1 other location - About 1 hr to fix
                          src/conversion/downcasthelpers.js on lines 1243..1249

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

                          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