Showing 48 of 55 total issues
Function _read
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_read(address, word = false) {
let ax = this;
let buffer = Buffer.from([
this.config.id, // AX12 ID
0x04, // Length
Function constructor
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(name, config) {
super();
// Check arguments
if (typeof config.infraredMaxDistance === 'undefined') {
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([
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),
- 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 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) {
- 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 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);
Function refreshDataLoop
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
refreshDataLoop() {
let motionDriver = this;
this.refreshData(() => {
let data = motionDriver.getData();
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),
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. ' +
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();
- 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 constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(name, config) {
this.config = Object.assign({
ejectorSpeed: 150,
colorTimeout: 6000
}, config);
Function init
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async init() {
let motionDriver = this;
this.reset();
this.setPositionAndOrientation(
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++) {
- 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 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();
}
- 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 _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;
- 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 rgbToHsl
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
rgbToHsl(r, g, b) {
r /= 255;
g /= 255;
b /= 255;
- 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 rgbToHsv
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
rgbToHsv(r, g, b) {
r /= 255;
g /= 255;
b /= 255;
- 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 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
- 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 _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) {
- 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 _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),
- 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"