Memristor-Robotics/mep-master

View on GitHub
src/services/motion/MotionService.js

Summary

Maintainability
B
4 hrs
Test Coverage

Function tryRerouting has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    tryRerouting() {
        let motionService = this;

        let pfTarget = this._targetQueue.getTargetBack();
        if (pfTarget !== null) {
Severity: Minor
Found in src/services/motion/MotionService.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 _onObstacleDetected has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    _onObstacleDetected(params) {
        if (this._targetQueue.getTargetFront() === null) return;

        let hazardAngle = (this.motionDriver.getDirection() === MotionDriver.DIRECTION_FORWARD) ?
            this.config.hazardAngleFront : this.config.hazardAngleBack;
Severity: Minor
Found in src/services/motion/MotionService.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

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

    straight(millimeters, params) {
        // Update last moving directiObstacle is too long in front of roboton
        if (this.motionDriver.getDirection() !== MotionDriver.DIRECTION_UNDEFINED) {
            this._lastDirection = this.motionDriver.getDirection();
        }
Severity: Minor
Found in src/services/motion/MotionService.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

Function _goSingleTarget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    _goSingleTarget(point, params) {
        Mep.Log.debug(TAG, 'Simple target go',  point);
        this._paused = false;

        // Set speed
Severity: Minor
Found in src/services/motion/MotionService.js - About 35 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

Function _onPathObstacleDetected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _onPathObstacleDetected(detected, friend) {
        if (detected === true) {
            let target = this._targetQueue.getTargetFront();
            let timeout = (friend === true) ? target.getParams().friend : target.getParams().obstacle;

Severity: Minor
Found in src/services/motion/MotionService.js - About 25 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

             TODO: Try to redesign a path in runtime
Severity: Minor
Found in src/services/motion/MotionService.js by fixme

There are no issues that match your filters.

Category
Status