Showing 372 of 564 total issues
Function _wrapAttributeElement
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
_wrapAttributeElement( wrapper, toWrap ) {
if ( !canBeJoined( wrapper, toWrap ) ) {
return false;
}
- Read upRead up
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;
- Read upRead up
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
*/
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();
Schema
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Schema {
/**
* Creates schema instance.
*/
constructor() {
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;
}
UpcastWriter
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
export default class UpcastWriter {
/**
* @param {module:engine/view/document~Document} document The view document instance in which this upcast writer operates.
*/
constructor( document ) {
Function bufferOperation
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
bufferOperation( operation ) {
// Below we take an operation, check its type, then use its parameters in marking (private) methods.
// The general rule is to not mark elements inside inserted element. All inserted elements are re-rendered.
// Marking changes in them would cause a "double" changing then.
//
Function viewPositionToDom
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
viewPositionToDom( viewPosition ) {
const viewParent = viewPosition.parent;
if ( viewParent.is( 'text' ) ) {
const domParent = this.findCorrespondingDomText( viewParent );
- Read upRead up
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
Node
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Node {
/**
* Creates a model node.
*
* This is an abstract class, so this constructor should not be used directly.
Function _previous
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
_previous() {
let position = this.position.clone();
const previousPosition = this.position;
const parent = position.parent;
Function stringify
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function stringify( node, selectionOrPositionOrRange = null, markers = null ) {
const model = new Model();
const mapper = new Mapper();
let selection, range;
Function _test
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
_test( type, item ) {
const items = isArray( item ) ? item : [ item ];
const consumables = this._consumables[ type ];
for ( const name of items ) {
- Read upRead up
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 _previous
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
_previous() {
const previousPosition = this.position;
const position = this.position.clone();
const parent = this._visitedParent;
- Read upRead up
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 _getPositions
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getPositions( node ) {
if ( node.is( 'documentFragment' ) || node.is( 'element' ) ) {
// Copy elements into the array, when nodes will be removed from parent node this array will still have all the
// items needed for iteration.
const children = [ ...node.getChildren() ];
Function _next
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
_next() {
let position = this.position.clone();
const previousPosition = this.position;
const parent = position.parent;
Consider simplifying this complex logical expression. Open
if ( !name ) {
return type === 'containerElement' || type === 'view:containerElement' ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
type === this.name || type === 'view:' + this.name ||
type === 'element' || type === 'view:element' ||
Consider simplifying this complex logical expression. Open
if ( !name ) {
return type === 'attributeElement' || type === 'view:attributeElement' ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
type === this.name || type === 'view:' + this.name ||
type === 'element' || type === 'view:element' ||
Consider simplifying this complex logical expression. Open
if ( !name ) {
return type === 'uiElement' || type === 'view:uiElement' ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
type === this.name || type === 'view:' + this.name ||
type === 'element' || type === 'view:element' ||
Selection
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Selection {
/**
* Creates new selection instance.
*
* **Note**: The selection constructor is available as a factory method: