Showing 28 of 50 total issues
Function end
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
end(inputs) {
if (this.numInputs === inputs.length) {
let output = {
data: [],
};
- 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 move
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
move(inputs, state, element) {
if (this.numInputs !== inputs.length) return null;
const output = {
data: [],
Function end
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
end(inputs) {
if (this.numInputs === inputs.length) {
let output = {
data: [],
};
Function arbiter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function arbiter(event, region) {
const state = region.state;
const eventType = util.normalizeEvent[ event.type ];
/*
Function move
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
move(inputs, state, element) {
const numActiveInputs = state.numActiveInputs();
if (this.numInputs !== numActiveInputs) return null;
let currentPivot, initialPivot;
Function updateInputs
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateInputs(event, regionElement) {
let eventType = (event.touches) ?
'TouchEvent' : ((event.pointerType) ? 'PointerEvent' : 'MouseEvent');
switch (eventType) {
case 'TouchEvent':
Function updateInputs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
updateInputs(event, regionElement) {
let eventType = (event.touches) ?
'TouchEvent' : ((event.pointerType) ? 'PointerEvent' : 'MouseEvent');
switch (eventType) {
case 'TouchEvent':
- 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 packData
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function packData( input, progress ) {
const distanceFromOrigin = util.distanceBetweenTwoPoints(
input.initial.x,
input.current.x,
input.initial.y,
Function end
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
end(inputs) {
if (inputs.length !== this.numInputs) {
return null;
}
let startTime = Number.MAX_VALUE;
- 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 exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (env, argv) => {
argv.mode = argv.mode || 'production';
const plugins = [];
const filename = (argv.mode === 'production') ? 'zingtouch.min.js' : 'zingtouch.js';
const config = {
Function end
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
end(inputs) {
if (inputs.length !== this.numInputs) {
return null;
}
let startTime = Number.MAX_VALUE;
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(element, capture, preventDefault, id) {
/**
* The identifier for the Region. This is assigned by the ZingTouch object
* and is used to hash gesture id for uniqueness.
* @type {Number}
Function arbiter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function arbiter(event, region) {
const state = region.state;
const eventType = util.normalizeEvent[ event.type ];
/*
- 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 addBinding
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
addBinding(element, gesture, handler, capture, bindOnce) {
let boundGesture;
// Error type checking.
if (element && typeof element.tagName === 'undefined') {
- 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 move
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
move(inputs, state, element) {
if (this.numInputs === inputs.length) {
for (let i = 0; i < inputs.length; i++) {
let progress = inputs[i].getGestureProgress(this.getId());
if (!progress.moves) {
- 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 move
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
move(inputs, state, element) {
if (state.numActiveInputs() === DEFAULT_INPUTS) {
const currentDistance = util.distanceBetweenTwoPoints(
inputs[0].current.x,
inputs[1].current.x,
Function constructor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
constructor(options) {
super();
/**
* The type of the Gesture
* @type {String}
- 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 getVelocity
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
getVelocity(startX, startY, startTime, endX, endY, endTime) {
Avoid deeply nested control flow statements. Open
if (progress.moves[index].time !== currentMove.time) {
lastMove = progress.moves[index];
break;
}
Function isWithin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
isWithin(currentX, currentY, previousX, previousY, tolerance) {