Showing 889 of 1,485 total issues
Function $internalResolveSelectionPoints
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function $internalResolveSelectionPoints(
anchorDOM: null | Node,
anchorOffset: number,
focusDOM: null | Node,
focusOffset: number,
- 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 selectPointOnNode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function selectPointOnNode(point: PointType, node: LexicalNode): void {
let key = node.__key;
let offset = point.offset;
let type: 'element' | 'text' = 'element';
if ($isTextNode(node)) {
- 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 $splitNodeAtPoint
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function $splitNodeAtPoint(
node: LexicalNode,
offset: number,
): [parent: ElementNode, offset: number] {
const parent = node.getParent();
- 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 getChildAtIndex
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
getChildAtIndex<T extends LexicalNode>(index: number): null | T {
const size = this.getChildrenSize();
let node: null | T;
let i;
if (index < size / 2) {
- 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 request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected async request(url: string, options: RequestOptions & RequestInit = {}): Promise<FormattedResponse> {
let requestUrl = url;
if (!requestUrl.startsWith('http')) {
requestUrl = window.baseUrl(requestUrl);
- 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 exportDOM
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exportDOM(editor: LexicalEditor): DOMExportOutput {
let {element} = super.exportDOM(editor);
invariant(
element !== null && isHTMLElement(element),
'Expected TextNode createDOM to always return a HTMLElement',
- 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 $shouldInsertTextAfterOrBeforeTextNode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function $shouldInsertTextAfterOrBeforeTextNode(
selection: RangeSelection,
node: TextNode,
): boolean {
if (node.isSegmented()) {
- 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 $garbageCollectDetachedDeepChildNodes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function $garbageCollectDetachedDeepChildNodes(
node: ElementNode,
parentKey: NodeKey,
prevNodeMap: NodeMap,
nodeMap: NodeMap,
- 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
Method loadFromJwkArray
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loadFromJwkArray(array $jwk)
{
// 'alg' is optional for a JWK, but we will still attempt to validate if
// it exists otherwise presume it will be compatible.
$alg = $jwk['alg'] ?? null;
Method checkUserHasAccessToRelationOfImageAtPath
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function checkUserHasAccessToRelationOfImageAtPath(string $path): bool
{
if (str_starts_with($path, 'uploads/images/')) {
$path = substr($path, 15);
}
Method getProviderSettings
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getProviderSettings(): OidcProviderSettings
{
$config = $this->config();
$settings = new OidcProviderSettings([
'issuer' => $config['issuer'],
Function updateDOM
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateDOM(prevNode: MediaNode, dom: HTMLElement): boolean {
if (prevNode.__tag !== this.__tag) {
return true;
}
Function buildDOM
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildDOM(): HTMLElement {
const colorOptions = colorChoices.map(choice => {
return el('div', {
class: 'editor-color-select-option',
Function getWordsFromString
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getWordsFromString = function (string: string): Array<Segment> {
const segments: Segment[] = [];
let wordString = '';
let nonWordString = '';
let i;
Function $copyToClipboardEvent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $copyToClipboardEvent(
editor: LexicalEditor,
event: ClipboardEvent,
data?: LexicalClipboardData,
): boolean {
Function removeRootElementEvents
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function removeRootElementEvents(rootElement: HTMLElement): void {
const doc = rootElement.ownerDocument;
const documentRootElementsCount = rootElementsRegistered.get(doc);
invariant(
documentRootElementsCount !== undefined,
Function $updateCaretSelectionForUnicodeCharacter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $updateCaretSelectionForUnicodeCharacter(
selection: RangeSelection,
isBackward: boolean,
): void {
const anchor = selection.anchor;
Function $normalizeSelectionPointsForBoundaries
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $normalizeSelectionPointsForBoundaries(
anchor: PointType,
focus: PointType,
lastSelection: null | BaseSelection,
): void {
Function exportNodeToJSON
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function exportNodeToJSON<SerializedNode extends SerializedLexicalNode>(
node: LexicalNode,
): SerializedNode {
const serializedNode = node.exportJSON();
const nodeClass = node.constructor;
Function $updateSelectedTextFromDOM
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function $updateSelectedTextFromDOM(
isCompositionEnd: boolean,
editor: LexicalEditor,
data?: string,
): void {