Showing 6 of 15 total issues
DroneCommand
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class DroneCommand {
/**
* Creates a new DroneCommand instance
* @param {object} project - Project node from the xml spec
* @param {object} class_ - Class node from the xml spec
Function _setupPeripheral
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupPeripheral() {
this.peripheral.discoverAllServicesAndCharacteristics((err, services, characteristics) => {
if (err) {
throw err;
}
Function _handleIncoming
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleIncoming(channelUuid, buffer) {
const channel = receiveUuids.findForValue(channelUuid);
let callback;
switch (channel) {
Function parseBuffer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
parseBuffer(buffer) {
const command = this._getCommandFromBuffer(buffer);
let bufferOffset = 4;
- 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 _handleIncoming
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_handleIncoming(channelUuid, buffer) {
const channel = receiveUuids.findForValue(channelUuid);
let callback;
switch (channel) {
- 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 getCommand
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getCommand(projectName, className, commandName, commandArguments = {}) {
const cacheToken = [projectName, className, commandName].join('-');
if (typeof this._commandCache[cacheToken] === 'undefined') {
// Find project
- 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"