Memristor-Robotics/mep-master

View on GitHub

Showing 55 of 55 total issues

DynamixelDriver has 72 functions (exceeds 20 allowed). Consider refactoring.
Open

class DynamixelDriver {
    static get AX_MODEL_NUMBER_L() { return 0; }
    static get AX_MODEL_NUMBER_H() { return 1; }
    static get AX_VERSION() { return 2; }
    static get AX_SERVO_ID() { return 3; }
Severity: Major
Found in src/drivers/dynamixel/DynamixelDriver.js - About 1 day to fix

    MotionDriver has 68 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MotionDriver extends EventEmitter  {
        static get STATE_IDLE() { return 'I'.charCodeAt(0); }
        static get STATE_STUCK() { return 'S'.charCodeAt(0); }
        static get STATE_MOVING() { return 'M'.charCodeAt(0); }
        static get STATE_ROTATING() { return 'R'.charCodeAt(0); }
    Severity: Major
    Found in src/drivers/motion/MotionDriver.js - About 1 day to fix

      File MotionDriver.js has 407 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      /** @namespace drivers.motion */
      
      const Point = Mep.require("misc/geometry/Point");
      const EventEmitter = require('events');
      Severity: Minor
      Found in src/drivers/motion/MotionDriver.js - About 5 hrs to fix

        Function push has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            push(chunkBuffer) {
                // Append `tempBuffer` to `buffer`
                if (chunkBuffer !== null) {
                    if (chunkBuffer.length + this._bufferSize < this._buffer.length) {
                        chunkBuffer.copy(this._buffer, this._bufferSize);
        Severity: Minor
        Found in src/misc/protocols/PLLSP.js - About 3 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

        MotionDriverSimulator has 29 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class MotionDriverSimulator extends EventEmitter {
            static get STATE_IDLE() { return 'I'.charCodeAt(0); }
            static get STATE_STUCK() { return 'S'.charCodeAt(0); }
            static get STATE_MOVING() { return 'M'.charCodeAt(0); }
            static get STATE_ROTATING() { return 'R'.charCodeAt(0); }
        Severity: Minor
        Found in src/drivers/motion/MotionDriverSimulator.js - About 3 hrs to fix

          File DynamixelDriver.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          /** @namespace drivers.dynamixel */
          const TaskError = Mep.require('strategy/TaskError');
          
          
          Severity: Minor
          Found in src/drivers/dynamixel/DynamixelDriver.js - About 3 hrs to fix

            LunarCollectorDriver has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

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

              Function push has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  push(chunkBuffer) {
                      // Append `tempBuffer` to `buffer`
                      if (chunkBuffer !== null) {
                          if (chunkBuffer.length + this._bufferSize < this._buffer.length) {
                              chunkBuffer.copy(this._buffer, this._bufferSize);
              Severity: Major
              Found in src/misc/protocols/PLLSP.js - About 2 hrs to fix

                Function _addPointToPolyGenerator has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    _addPointToPolyGenerator(angle, distance) {
                        let point = new Point(0, distance);
                        point.rotateAroundZero(angle);
                
                        if (this._poly.polyPointsCount === 0) {
                Severity: Minor
                Found in src/drivers/lidar/LidarDriver.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

                Function waitStartSignal has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    waitStartSignal() {
                        let starterDriver = this;
                
                        Mep.Log.info('Software is initialized');
                
                
                Severity: Minor
                Found in src/drivers/starter/StarterDriver.js - About 1 hr to fix

                  Function _getOffsetPoints has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      _getOffsetPoints(points) {
                          if (points.length === 4) {
                              let minX = points[0].getX();
                              let minY = points[0].getY();
                              let maxX = points[0].getX();
                  Severity: Minor
                  Found in src/services/terrain/TerrainService.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 make has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      static make() {
                          global.Scheduler = Mep.require('strategy/Scheduler');
                          global.Task = Mep.require('strategy/Task');
                  
                          global.delay = Mep.require('misc/Delay');
                  Severity: Minor
                  Found in src/strategy/Shortcut.js - About 1 hr to fix

                    Function _promiseToStateChanged has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _promiseToStateChanged() {
                            let motionDriver = this;
                    
                            let timeout = setTimeout(() => {
                                motionDriver.emit('stateChanged', MotionDriver.STATE_STUCK);
                    Severity: Minor
                    Found in src/drivers/motion/MotionDriver.js - About 1 hr to fix

                      Function _addPointToPolyGenerator has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _addPointToPolyGenerator(angle, distance) {
                              let point = new Point(0, distance);
                              point.rotateAroundZero(angle);
                      
                              if (this._poly.polyPointsCount === 0) {
                      Severity: Minor
                      Found in src/drivers/lidar/LidarDriver.js - About 1 hr to fix

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

                            write(value) {
                                if (this.config.direction === 'output') {
                                    if (this.config.mode === 'digital') {
                                        if (value > 1 || value < 0) {
                                            value = 1;
                        Severity: Minor
                        Found in src/drivers/pin/PinDriver.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 39 lines of code (exceeds 25 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

                          Function go has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              go(position, config) {
                                  let c = Object.assign({
                                      pollingPeriod: 300,
                                      tolerance: 35,
                                      timeout: 3000,
                          Severity: Minor
                          Found in src/drivers/dynamixel/DynamixelDriver.js - About 1 hr to fix

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

                                constructor(name, config) {
                                    super();
                            
                                    // Merge configs
                                    this.config = Object.assign({
                            Severity: Minor
                            Found in src/drivers/lidar/LidarDriver.js - About 1 hr to fix

                              Function _initDriver has a Cognitive Complexity of 12 (exceeds 5 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

                              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 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
                                Severity
                                Category
                                Status
                                Source
                                Language