Showing 163 of 163 total issues
Avoid deeply nested control flow statements. Open
if (!listeners.length) {
delegates.splice(index, 1)
// remove delegate function from context
remove(context, type, delegateListener)
Avoid deeply nested control flow statements. Open
if (typeListeners.length === 0) {
delete target.events[type]
typeIsEmpty = true
}
Function start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
start(event: PointerEventType) {
const { interaction } = this
const options = getOptions(interaction)
if (!options || !options.enabled) {
- 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
Consider simplifying this complex logical expression. Open
if (
t.isStringLiteral(key) &&
(!include || include.indexOf(key.value) !== -1) &&
(!exclude || exclude.indexOf(key.value) === -1)
) {
Consider simplifying this complex logical expression. Open
if (is.object(resizeOptions.edges)) {
const resizeEdges = {
left: false,
right: false,
top: false,
Consider simplifying this complex logical expression. Open
if (!browser.supportsPointerEvent && /mouse/.test(event.type)) {
// ignore mouse events while touch interactions are active
for (let i = 0; i < interactions.length && !invalidPointer; i++) {
invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown
}
Consider simplifying this complex logical expression. Open
if (
(is.element(accept) && accept !== draggableElement) ||
(is.string(accept) && !domUtils.matchesSelector(draggableElement, accept)) ||
(is.func(accept) && !accept({ dropzone, draggableElement }))
) {
Consider simplifying this complex logical expression. Open
if (
!closest.target ||
(inRange
? // is the closest target in range?
closest.inRange && range !== Infinity
Function addDelegate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
selector: string,
context: Node,
type: string,
listener: ListenerEntry['func'],
optionalArg?: any,
Function _onOff
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Interactable.prototype._onOff = function (method, typeArg, listenerArg, options, filter) {
Function startReflow
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
scope: Scope,
interactable: Interactable,
element: Element,
action: ActionProps<T>,
event: any,
Function getActionInfo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
interaction: Interaction,
pointer: PointerType,
event: PointerEventType,
eventTarget: Node,
scope: Scope,
Function removeDelegate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
selector: string,
context: Document | Element,
type: string,
listener?: ListenerEntry['func'],
optionalArg?: any,
Function validateAction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
action: ActionProps<T>,
interactable: Interactable,
element: Element,
eventTarget: Node,
scope: Scope,
Function defaultActionChecker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
interactable: Interactable,
event: PointerEventType,
interaction: Interaction,
element: Element,
scope: Scope,
Function getAction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
this: Interactable,
pointer: PointerType,
event: PointerEventType,
interaction: Interaction,
element: Element,
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 updateGestureProps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function updateGestureProps({ interaction, iEvent, phase }: GestureSignalArg) {
if (interaction.prepared.name !== 'gesture') return
const pointers = interaction.pointers.map((p) => p.pointer)
const starting = phase === 'start'
- 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 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 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"