Showing 48 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; }
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); }
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');
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);
- Read upRead up
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); }
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');
LunarCollectorDriver
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class LunarCollectorDriver {
constructor(name, config) {
this.config = Object.assign({
ejectorSpeed: 150,
colorTimeout: 6000
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);
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) {
- Read upRead up
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');
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();
- Read upRead up
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');
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);
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) {
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;
- Read upRead up
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),
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,
Function constructor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(name, config) {
super();
// Merge configs
this.config = Object.assign({
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. ' +
- Read upRead up
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
};