lib/network/modules/components/edges/util/EdgeBase.js

Summary

Maintainability
D
2 days
Test Coverage

File EdgeBase.js has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

let util = require("../../../../../util");
let EndPoints = require("./EndPoints").default;


/**
Severity: Minor
Found in lib/network/modules/components/edges/util/EdgeBase.js - About 4 hrs to fix

    Function getArrowData has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getArrowData(ctx, position, viaNode, selected, hover, values) {
        // set lets
        let angle;
        let arrowPoint;
        let node1;
    Severity: Major
    Found in lib/network/modules/components/edges/util/EdgeBase.js - About 2 hrs to fix

      Function getArrowData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        getArrowData(ctx, position, viaNode, selected, hover, values) {
          // set lets
          let angle;
          let arrowPoint;
          let node1;
      Severity: Minor
      Found in lib/network/modules/components/edges/util/EdgeBase.js - About 2 hrs 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

      EdgeBase has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class EdgeBase {
        /**
         * @param {Object} options
         * @param {Object} body
         * @param {Label} labelModule
      Severity: Minor
      Found in lib/network/modules/components/edges/util/EdgeBase.js - About 2 hrs to fix

        Function _findBorderPositionCircle has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          _findBorderPositionCircle(node, ctx, options) {
            let x = options.x;
            let y = options.y;
            let low = options.low;
            let high = options.high;
        Severity: Minor
        Found in lib/network/modules/components/edges/util/EdgeBase.js - About 1 hr 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

        Function _findBorderPositionCircle has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _findBorderPositionCircle(node, ctx, options) {
            let x = options.x;
            let y = options.y;
            let low = options.low;
            let high = options.high;
        Severity: Minor
        Found in lib/network/modules/components/edges/util/EdgeBase.js - About 1 hr to fix

          Function getColor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            getColor(ctx, values, selected, hover) {  // eslint-disable-line no-unused-vars
              if (values.inheritsColor !== false) {
                // when this is a loop edge, just use the 'from' method
                if ((values.inheritsColor === 'both') && (this.from.id !== this.to.id)) {
                  let grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y);
          Severity: Minor
          Found in lib/network/modules/components/edges/util/EdgeBase.js - About 1 hr 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

          Function _drawDashedLine has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _drawDashedLine(ctx, values, viaNode, fromPoint, toPoint) {  // eslint-disable-line no-unused-vars
              ctx.lineCap = 'round';
              let pattern = [5,5];
              if (Array.isArray(values.dashes) === true) {
                pattern = values.dashes;
          Severity: Minor
          Found in lib/network/modules/components/edges/util/EdgeBase.js - About 1 hr to fix

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

              getColor(ctx, values, selected, hover) {  // eslint-disable-line no-unused-vars
                if (values.inheritsColor !== false) {
                  // when this is a loop edge, just use the 'from' method
                  if ((values.inheritsColor === 'both') && (this.from.id !== this.to.id)) {
                    let grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y);
            Severity: Minor
            Found in lib/network/modules/components/edges/util/EdgeBase.js - About 1 hr to fix

              Function _drawDashedLine has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                _drawDashedLine(ctx, values, viaNode, fromPoint, toPoint) {  // eslint-disable-line no-unused-vars
                  ctx.lineCap = 'round';
                  let pattern = [5,5];
                  if (Array.isArray(values.dashes) === true) {
                    pattern = values.dashes;
              Severity: Minor
              Found in lib/network/modules/components/edges/util/EdgeBase.js - About 55 mins 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

              TODO found
              Open

                 * @param {{x: number, y: number}} [toPoint]    TODO: Remove in next major release

              TODO found
              Open

                 * @param {{x: number, y: number}} [fromPoint]  TODO: Remove in next major release

              There are no issues that match your filters.

              Category
              Status