Showing 163 of 163 total issues
Function main
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function main() {
const sources = fileArgs.length ? fileArgs : await getSources()
console.log(`Linting ${sources.length} 'file${sources.length === 1 ? '' : 's'}...`)
- 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 set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function set(arg: ModifierArg<RestrictSizeState>) {
const { interaction, state, rect, edges } = arg
const { options } = state
if (!edges) {
- 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 getPointerType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function getPointerType(pointer: { pointerType?: string; identifier?: number; type?: string }) {
return is.string(pointer.pointerType)
? pointer.pointerType
: is.number(pointer.pointerType)
? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType]!
- 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 set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
set(options: OptionsArg) {
const defaults = this._defaults
if (!is.object(options)) {
options = {}
- 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
Avoid too many return
statements within this function. Open
return is.element(value)
? // the value is an element to use as a resize handle
value === element
: // otherwise check if element matches value as selector
dom.matchesUpTo(element, value, interactableElement)
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return null
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return page.y > (height >= 0 ? rect.bottom : rect.top) - margin
Avoid too many return
statements within this function. Open
return true
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return autoStartMax > 0
Function init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function init(global: Window | typeof globalThis) {
request = global.requestAnimationFrame
cancel = global.cancelAnimationFrame
if (!request) {
- 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 set
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function set({ coords, edges, interaction, state }: ModifierArg<RestrictEdgesState>) {
const { offset, options } = state
if (!edges) {
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 clone
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function clone<T extends Object>(source: T): Partial<T> {
const dest = {} as Partial<T>
for (const prop in source) {
const value = source[prop]
- 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 updatePointer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
updatePointer(pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean) {
const id = pointerUtils.getPointerId(pointer)
let pointerIndex = this.getPointerIndex(pointer)
let pointerInfo = this.pointers[pointerIndex]
- 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 reject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
reject() {
const { dropState } = this._interaction
if (
this.type !== 'dropactivate' &&
- 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 start
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function start(arg: ModifierArg<SnapState>) {
const { interaction, interactable, element, rect, state, startOffset } = arg
const { options } = state
const origin = options.offsetWithOrigin ? getOrigin(arg) : { x: 0, y: 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 shouldDo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
shouldDo(options, preEnd?: boolean, phase?: string, requireEndOnly?: boolean) {
if (
// ignore disabled modifiers
!options ||
options.enabled === 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 draggable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const draggable: Interactable['draggable'] = function draggable(
this: Interactable,
options?: DraggableOptions | boolean,
): any {
if (is.object(options)) {
- 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"