cristiingineru/rabbit

View on GitHub
src/geometry.js

Summary

Maintainability
F
6 days
Test Coverage

Function Geometry has 564 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Geometry() {

  var EPSILON = Number.EPSILON || 2.220446049250313e-16,
      PI = Math.PI,
      sin = Math.sin,
Severity: Major
Found in src/geometry.js - About 2 days to fix

    Function Geometry has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
    Open

    export function Geometry() {
    
      var EPSILON = Number.EPSILON || 2.220446049250313e-16,
          PI = Math.PI,
          sin = Math.sin,
    Severity: Minor
    Found in src/geometry.js - About 1 day to fix

    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

    "use strict";
    
    
    export function Geometry() {
    
    
    Severity: Major
    Found in src/geometry.js - About 1 day to fix

      Function isPointInsideRectangle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        isPointInsideRectangle = (point, rectangle) => {
          var segments = [{
            x1: rectangle.x,
            y1: rectangle.y,
            x2: rectangle.x + rectangle.width,
      Severity: Minor
      Found in src/geometry.js - About 1 hr to fix

        Function arc has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            arc: (state, shape) => {
              var cx = shape.cx,
                  cy = shape.cy,
                  r = shape.r,
                  sx = shape.sx,
        Severity: Minor
        Found in src/geometry.js - About 1 hr to fix

          Function decomposeArcTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          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.
              //
          Severity: Minor
          Found in src/geometry.js - About 1 hr to fix

            Avoid too many return statements within this function.
            Open

                  return r * (sx * (aa)/(PI/2) + sy * (PI/2-aa)/(PI/2));
            Severity: Major
            Found in src/geometry.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return r * (sx * (aa)/(PI/2) + sy * (PI/2-aa)/(PI/2));
              Severity: Major
              Found in src/geometry.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return r * (sx * (PI/2-aa)/(PI/2) + sy * (aa)/(PI/2));
                Severity: Major
                Found in src/geometry.js - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status