Showing 372 of 564 total issues
Consider simplifying this complex logical expression. Open
if ( !name ) {
return type === 'emptyElement' || type === 'view:emptyElement' ||
// 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' ||
Range
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Range {
/**
* Creates a range spanning from `start` position to `end` position.
*
* **Note:** Constructor creates it's own {@link module:engine/view/position~Position} instances basing on passed values.
Function _next
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
_next() {
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 _generateActionsFromChanges
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function _generateActionsFromChanges( oldChildrenLength, changes ) {
const actions = [];
let offset = 0;
let oldChildrenHandled = 0;
- 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 insert
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
insert( item, itemOrPosition, offset = 0 ) {
this._assertWriterUsedCorrectly();
if ( item instanceof Text && item.data == '' ) {
return;
- 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 addBorderRules
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function addBorderRules( stylesProcessor ) {
stylesProcessor.setNormalizer( 'border', borderNormalizer );
// Border-position shorthands.
stylesProcessor.setNormalizer( 'border-top', getBorderPositionNormalizer( 'top' ) );
Renderer
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Renderer {
/**
* Creates a renderer instance.
*
* @param {module:engine/view/domconverter~DomConverter} domConverter Converter instance.
Differ
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Differ {
/**
* Creates a `Differ` instance.
*
* @param {module:engine/model/markercollection~MarkerCollection} markerCollection Model's marker collection.
Function findCorrespondingViewText
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
findCorrespondingViewText( domText ) {
if ( isInlineFiller( domText ) ) {
return null;
}
- 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 tryExtendingTo
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function tryExtendingTo( data, value ) {
// If found text, we can certainly put the focus in it. Let's just find a correct position
// based on the unit.
if ( value.type == 'text' ) {
if ( data.unit === 'word' ) {
- 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 _consume
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
_consume( 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 getCorrectWordBreakPosition
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function getCorrectWordBreakPosition( walker, isForward ) {
let textNode = walker.position.textNode;
if ( textNode ) {
let offset = walker.position.offset - textNode.startOffset;
- 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
View
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export default class View {
/**
* @param {module:engine/view/stylesmap~StylesProcessor} stylesProcessor The styles processor instance.
*/
constructor( stylesProcessor ) {
Function parseInlineStyles
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function parseInlineStyles( stylesString ) {
// `null` if no quote was found in input string or last found quote was a closing quote. See below.
let quoteType = null;
let propertyNameStart = 0;
let propertyValueStart = 0;
- 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
DocumentSelection
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export default class DocumentSelection {
/**
* Creates new DocumentSelection instance.
*
* // Creates empty selection without ranges.
Position
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Position {
/**
* Creates a position.
*
* @param {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment} parent Position parent.
Mapper
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Mapper {
/**
* Creates an instance of the mapper.
*/
constructor() {
Model
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Model {
constructor() {
/**
* Model's marker collection.
*
File insertcontent.js
has 255 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
*/
Function _walkView
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
_walkView( root, callback ) {
const ignore = this.ignoreRoot && this.root === root;
if ( root.is( 'element' ) || root.is( 'documentFragment' ) ) {
if ( root.is( 'element' ) && !ignore ) {
- 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"