Function computeOrientationProperties
has a Cognitive Complexity of 21 (exceeds 6 allowed). Consider refactoring.
const computeOrientationProperties = (legsNoGravity, flags = { shuffle: false }) => {
const someLegTrios = flags.shuffle
? shuffleArray(SOME_LEG_ID_TRIOS.slice())
: SOME_LEG_ID_TRIOS
Function solve
has 43 lines of code (exceeds 25 allowed). Consider refactoring.
solve(legDimensions, bodyContactPoints, groundContactPoints, axes) {
this.params = {
bodyContactPoints, groundContactPoints, axes, legDimensions
}
Function constructor
has 39 lines of code (exceeds 25 allowed). Consider refactoring.
constructor(
dimensions,
pose,
flags = { hasNoPoints: false, assumeKnownGroundPoints: false, wontRotate: false }
) {
Function solve
has a Cognitive Complexity of 13 (exceeds 6 allowed). Consider refactoring.
solve(legDimensions, bodyContactPoints, groundContactPoints, axes) {
this.params = {
bodyContactPoints, groundContactPoints, axes, legDimensions
}
Similar blocks of code found in 2 locations. Consider refactoring.
toggleWalkMode = () => {
const { gaitParams, isTripodGait } = this.state
const inWalkMode = !this.state.inWalkMode
this.setWalkSequence(gaitParams, isTripodGait, inWalkMode)
}
Similar blocks of code found in 2 locations. Consider refactoring.
toggleGaitType = () => {
const { gaitParams, inWalkMode } = this.state
const isTripodGait = !this.state.isTripodGait
this.setWalkSequence(gaitParams, isTripodGait, inWalkMode)
}
Function findTwoPivotPoints
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
const findTwoPivotPoints = (currentPoints, targetPoints, excludedPositions) => {
const targetPointsMap = targetPoints.reduce((acc, point) => {
acc[point.name] = point
return acc
}, {})
Function handleChange
has 29 lines of code (exceeds 25 allowed). Consider refactoring.
handleChange(value) {
const { minVal, maxVal, stepVal } = this.props.rangeParams
const validity = this.myRef.current.validity
if (validity.badInput) {
Function simpleTwist
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
const simpleTwist = groundLegsNoGravity => {
const firstLeg = groundLegsNoGravity[0]
const allSameAlpha = groundLegsNoGravity.every(
leg => leg.pose.alpha === firstLeg.pose.alpha
Function findTwoPivotPoints
has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring.
const findTwoPivotPoints = (currentPoints, targetPoints, excludedPositions) => {
const targetPointsMap = targetPoints.reduce((acc, point) => {
acc[point.name] = point
return acc
}, {})
Function mightTwist
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring.
const mightTwist = legsOnGround => {
let negativeAlphaCount = 0
let positiveAlphaCount = 0
for (let i = 0; i < legsOnGround.length; i++) {
Function constructor
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
constructor(
dimensions,
pose,
flags = { hasNoPoints: false, assumeKnownGroundPoints: false, wontRotate: false }
) {