src/drivers/dynamixel/DynamixelDriver.js
DynamixelDriver
has 72 functions (exceeds 20 allowed). Consider refactoring. Open
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; }
File DynamixelDriver.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
/** @namespace drivers.dynamixel */
const TaskError = Mep.require('strategy/TaskError');
Function go
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
go(position, config) {
let c = Object.assign({
pollingPeriod: 300,
tolerance: 35,
timeout: 3000,
Function _read
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_read(address, word = false) {
let ax = this;
let buffer = Buffer.from([
this.config.id, // AX12 ID
0x04, // Length
Function _onDataReceived
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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"