Showing 16 of 37 total issues
Core
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
export class Core {
// Override in child class to get right percent
protected maxVoltage: number = 0;
protected minVoltage: number = 1;
protected apiVersion: APIVersion = APIVersion.V2;
Function factory
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export function factory(
callback: (err: string, response?: ICommandWithRaw) => void
) {
let msg: number[] = [];
let checksum: number = 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 _onSensorEvent
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _onSensorEvent(event: ISensorResponse): void {
if (!this._calibrated) {
// Start orientation
this.referenceSpace.rotation(
Quaternion.fromEuler({
Function factory
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function factory(
callback: (err: string, response?: ICommandWithRaw) => void
) {
let msg: number[] = [];
let checksum: number = 0;
File core.ts
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { factory } from '../commands';
import { factory as decodeFactory, number } from '../commands/decoder';
import {
DeviceId,
DriveFlag,
Function calculateDomeAngle
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculateDomeAngle(angle: number) {
const result = new Uint8Array(2);
switch (angle) {
case -1:
result[0] = 0xbf;
Function encode
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function encode(command: ICommand): ICommandWithRaw {
const {
commandFlags = [Flags.requestsResponse, Flags.resetsInactivityTimeout],
deviceId,
commandId,
Function add
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
add(byte: number) {
switch (byte) {
case APIConstants.startOfPacket:
if (msg.length !== 0) {
init();
Function roll
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public roll(speed: number, heading: number, flags: DriveFlag[] = []): Promise<void> {
return new Promise((resolve, reject) => {
const spheroObject = this.source as SpheroDataObject<T>;
const position = spheroObject.getPosition() || new Absolute2DPosition(0, 0);
position.unit = LengthUnit.CENTIMETER;
Function bundle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const bundle = (env, module) => ({
name: PROJECT_NAME,
entry: `./dist/${module ? "esm" : "cjs"}/index.js`,
output: {
path: path.resolve(__dirname, 'dist'),
- 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 calculateDomeAngle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private calculateDomeAngle(angle: number) {
const result = new Uint8Array(2);
switch (angle) {
case -1:
result[0] = 0xbf;
- 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 sensorValuesToRawV2
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const sensorValuesToRawV2 = (
sensorMask: SensorMaskValues[],
apiVersion: APIVersion = APIVersion.V2
) =>
sensorMask.reduce((v2, m) => {
- 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
Avoid too many return
statements within this function. Open
return init();
Avoid too many return
statements within this function. Open
return error('Invalid escape char position');
Avoid too many return
statements within this function. Open
return error('Invalid no escape char end found');
Avoid too many return
statements within this function. Open
return;