src/geometry.js
Function Geometry
has 564 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function Geometry() {
var EPSILON = Number.EPSILON || 2.220446049250313e-16,
PI = Math.PI,
sin = Math.sin,
Function Geometry
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
Open
export function Geometry() {
var EPSILON = Number.EPSILON || 2.220446049250313e-16,
PI = Math.PI,
sin = Math.sin,
- 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
File geometry.js
has 567 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"use strict";
export function Geometry() {
Function isPointInsideRectangle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
isPointInsideRectangle = (point, rectangle) => {
var segments = [{
x1: rectangle.x,
y1: rectangle.y,
x2: rectangle.x + rectangle.width,
Function arc
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
arc: (state, shape) => {
var cx = shape.cx,
cy = shape.cy,
r = shape.r,
sx = shape.sx,
Function decomposeArcTo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
decomposeArcTo = (x0, y0, x1, y1, x2, y2, r, sx, sy) => {
//
// The sx and sy is used to scale the radius (r) only.
//All other coordinates have to be already scaled.
//
Avoid too many return
statements within this function. Open
Open
return r * (sx * (aa)/(PI/2) + sy * (PI/2-aa)/(PI/2));
Avoid too many return
statements within this function. Open
Open
return r * (sx * (aa)/(PI/2) + sy * (PI/2-aa)/(PI/2));
Avoid too many return
statements within this function. Open
Open
return r * (sx * (PI/2-aa)/(PI/2) + sy * (aa)/(PI/2));