Memristor-Robotics/mep-master

View on GitHub

Showing 48 of 55 total issues

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

    getColor() {
        let bestMatch = {
            difference: Infinity,
            color: null
        };
Severity: Minor
Found in src/drivers/color/ColorDriver.js - About 1 hr to fix

    Function constructor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        constructor(name, config) {
            super();
    
            // Check arguments
            if (typeof config.infraredMaxDistance === 'undefined') {
    Severity: Minor
    Found in src/drivers/infrared/InfraredDriver.js - About 1 hr to fix

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

          moveToCurvilinear(position, direction, radius, tolerance) {
              let motionDriver = this;
      
              this._direction = direction;
              this._sendCommand(Buffer.from([
      Severity: Minor
      Found in src/drivers/motion/MotionDriver.js - About 1 hr to fix

        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 _onPReceived has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            _onPReceived(buffer) {
                // Ignore garbage
                let state = buffer.readInt8(0);
                let position = new Point(
                    (buffer.readInt8(1) << 8) | (buffer.readInt8(2) & 0xFF),
        Severity: Minor
        Found in src/drivers/motion/MotionDriver.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 refreshDataLoop has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            refreshDataLoop() {
                let motionDriver = this;
        
                this.refreshData(() => {
                    let data = motionDriver.getData();
        Severity: Minor
        Found in src/drivers/motion/MotionDriverNative.js - About 1 hr to fix

          Function stateListener has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      let stateListener = (name, state) => {
                          switch (state) {
                              case MotionDriver.STATE_IDLE:
                                  Mep.Log.debug(TAG, 'Resolved');
                                  clearTimeout(timeout);
          Severity: Minor
          Found in src/drivers/motion/MotionDriver.js - About 1 hr to fix

            Function _onDataReceived has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _onDataReceived(buffer) {
                    if (buffer.length === 3) {
                        this.lastReadings = [
                            buffer.readUInt8(0),
                            buffer.readUInt8(1),
            Severity: Minor
            Found in src/drivers/color/ColorDriver.js - About 1 hr to fix

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

                  async _initDriver(driverIdentifier) {
                      let moduleConfig = this.config[driverIdentifier];
              
                      if (moduleConfig === undefined) {
                          throw Error('Driver ' + driverIdentifier + ' is missing in configuration. ' +
              Severity: Minor
              Found in src/drivers/DriverManager.js - About 1 hr to fix

                Function isPointInside has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    isPointInside(point) {
                        let minX = this.points[0].getX();
                        let maxX = this.points[0].getX();
                        let minY = this.points[0].getY();
                        let maxY = this.points[0].getY();
                Severity: Minor
                Found in src/misc/geometry/Polygon.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 constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    constructor(name, config) {
                        this.config = Object.assign({
                            ejectorSpeed: 150,
                            colorTimeout: 6000
                        }, config);
                Severity: Minor
                Found in src/drivers/lunarcollector/LunarCollectorDriver.js - About 1 hr to fix

                  Function init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      async init() {
                          let motionDriver = this;
                  
                          this.reset();
                          this.setPositionAndOrientation(
                  Severity: Minor
                  Found in src/drivers/motion/MotionDriver.js - About 1 hr to fix

                    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 rgbToHsl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        rgbToHsl(r, g, b) {
                            r /= 255;
                            g /= 255;
                            b /= 255;
                    
                    
                    Severity: Minor
                    Found in src/drivers/color/ColorDriver.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 constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        constructor(defaultX, defaultY) {
                            let table = Mep.Config.get('table');
                    
                            // If there are table dependent points
                            for (let i = 2; i < arguments.length; i++) {
                    Severity: Minor
                    Found in src/strategy/TunedPoint.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 recommendNextTask has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        recommendNextTask(tasks) {
                            let maxWeightTask = null;
                    
                            for (let i = 0; i < tasks.length; i++) {
                                // Find the best task
                    Severity: Minor
                    Found in src/services/scheduler/SchedulerService.js - About 45 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 _onDataReceived has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        _onDataReceived(data) {
                            if (data.readUInt8(0) === (this.config.id | 0)) {
                    
                                // Length === 1 means there is an error in communication (UART, Servo <--> AVR)
                                if (data.length === 2) {
                    Severity: Minor
                    Found in src/drivers/dynamixel/DynamixelDriver.js - About 45 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 rgbToHsv has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        rgbToHsv(r, g, b) {
                            r /= 255;
                            g /= 255;
                            b /= 255;
                    
                    
                    Severity: Minor
                    Found in src/drivers/color/ColorDriver.js - About 45 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 _onDataReceived has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        _onDataReceived(buffer) {
                            if (buffer.length === 3) {
                                this.lastReadings = [
                                    buffer.readUInt8(0),
                                    buffer.readUInt8(1),
                    Severity: Minor
                    Found in src/drivers/color/ColorDriver.js - About 45 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

                    Severity
                    Category
                    Status
                    Source
                    Language