Showing 163 of 163 total issues
Function doReflow
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function doReflow<T extends ActionName>(
interactable: Interactable,
action: ActionProps<T>,
scope: Scope,
): Promise<Interactable> {
- 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 remove
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function remove(
eventTarget: PartialEventTarget,
type: string,
listener?: 'all' | ListenerEntry['func'],
optionalArg?: boolean | EventOptions,
Function checkResizeEdge
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkResizeEdge(
name: string,
value: any,
page: Point,
element: Node,
Function getDropEvents
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getDropEvents(interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {
const dropState = interaction.dropState!
const dropEvents: Record<string, DropEvent | null> = {
enter: null,
leave: null,
Function start
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
start(event: PointerEventType) {
const { interaction } = this
const options = getOptions(interaction)
if (!options || !options.enabled) {
Function setPerAction
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
setPerAction(actionName: ActionName, options: OrBoolean<Options>) {
const defaults = this._defaults
// for all the default per-action options
for (const optionName_ in 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
Function transformInlineEnvironmentVariables
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function transformInlineEnvironmentVariables({ types: t }) {
return {
name: '@interactjs/_dev:inline-env-vars',
visitor: {
// eslint-disable-next-line no-shadow
- 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 install
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function install(scope: Scope, { logger }: { logger?: Logger } = {}) {
const { Interactable, defaults } = scope
scope.logger = logger || console
- 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 scroll
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
scroll() {
const { interaction } = autoScroll
const { interactable, element } = interaction
const actionName = interaction.prepared.name
const options = interactable.options[actionName].autoScroll
Function init
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init(window: any) {
const Element = domObjects.Element
const navigator: Partial<Navigator> = window.navigator || {}
// Does the browser support touch input?
Consider simplifying this complex logical expression. Open
if (rect && !('x' in rect && 'y' in rect)) {
rect = extend({}, rect)
rect.x = rect.left || 0
rect.y = rect.top || 0
Function pointerMove
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
pointerMove(pointer: PointerType, event: PointerEventType, eventTarget: Node) {
if (!this.simulation && !(this.modification && this.modification.endResult)) {
this.updatePointer(pointer, event, eventTarget, false)
}
Function doReflow
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function doReflow<T extends ActionName>(
interactable: Interactable,
action: ActionProps<T>,
scope: Scope,
): Promise<Interactable> {
Function coordsToEvent
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function coordsToEvent(coords: MockCoords) {
const event = {
coords,
get page() {
return this.coords.page
Function updatePointer
has 40 lines of code (exceeds 25 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]
Function scroll
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
scroll() {
const { interaction } = autoScroll
const { interactable, element } = interaction
const actionName = interaction.prepared.name
const options = interactable.options[actionName].autoScroll
- 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 usePlugin
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
usePlugin(plugin: Plugin, options?: { [key: string]: any }) {
if (!this.isInitialized) {
return this
}
- 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 setAll
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
setAll(arg: MethodArg & Partial<ModifierArg>): ModificationResult {
const { phase, preEnd, skipModifiers, rect: unmodifiedRect, edges: unmodifiedEdges } = arg
arg.coords = extend({}, arg.pageCoords)
arg.rect = extend({}, unmodifiedRect)
Function start
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
start(arg) {
const { state, rect, edges, pageCoords: coords } = arg
let { ratio, enabled } = state.options
const { equalDelta, modifiers } = state.options
Function onInteractionMove
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
onInteractionMove<T extends ActionName>({
interaction,
pointer,
}: {
interaction: Interaction<T>