Showing 38 of 62 total issues
Function createPlmBufferProcessor
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createPlmBufferProcessor = () => {
let previousBuffer = ''
const processPlmBuffer = buffer => {
const previousBufferLength = previousBuffer.length > 2
Function objectToString
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function objectToString (object, indent = '') {
if (object === undefined) {
return 'undefined'
}
if (object === null) {
Function addAllLinkRecord
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const addAllLinkRecord = record => {
if (record.insteonCommand && record.insteonCommand.type === 'Record Response') {
addAllLinkRecord(record.insteonCommand)
return
}
Function createAllLinkRecord
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createAllLinkRecord = buffer => {
const flags = parseInt(buffer.substring(0, 2), 16)
const response = {
inUse: (0x80 & flags) !== 0,
isController: (0x40 & flags) !== 0,
Function createCommandAnnotator
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createCommandAnnotator = (deviceNames) => {
const addDeviceName = command => {
if (command.fromAddress) {
command.fromDevice = deviceNames[command.fromAddress]
}
Function createAllLinkDatabase
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const createAllLinkDatabase = () => {
const entries = {}
const addAllLinkRecord = record => {
if (record.insteonCommand && record.insteonCommand.type === 'Record Response') {
- 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 processPlmBuffer
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const processPlmBuffer = buffer => {
const previousBufferLength = previousBuffer.length > 2
? parseInt(previousBuffer.slice(-2), 16)
: 0
const bufferLength = buffer && buffer.length > 2
Function objectToString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function objectToString (object, indent = '') {
if (object === undefined) {
return 'undefined'
}
if (object === 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 standard
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const standard = (
messageType,
command1And2,
commandName,
command2PropertyOrParser
- 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 parsePlmBuffer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const parsePlmBuffer = (inputBuffer, previousCommand) => {
let command
const startOfText = inputBuffer.indexOf('02')
const buffer = inputBuffer.substring(startOfText)
if (startOfText < 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
Avoid too many return
statements within this function. Open
return '[\n' +
indent + ' ' +
object.map(element => objectToString(element, indent + ' '))
.join(',\n ' + indent) +
'\n' + indent + ']'
Avoid too many return
statements within this function. Open
return '{}'
Avoid too many return
statements within this function. Open
return {
buffer: buffer.substring(4 + command.length),
command,
}
Avoid too many return
statements within this function. Open
return { buffer }
Avoid too many return
statements within this function. Open
return '[]'
Avoid too many return
statements within this function. Open
return '{\n' +
indent + ' ' +
keys.map(key => keyValueToString(key, object[key], indent))
.join(',\n ' + indent) +
',\n' + indent + '}'
Function sd
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const sd = (name, command1, command2 = '00') => {
const encoder = command =>
/* eslint no-nested-ternary: "off" */
encoders['Send INSTEON Standard-length Message']({
messageType: 'direct',
- 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 ed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const ed = (name, command1, command2 = '00', userData = '', matcher) => {
const encoder = command => {
return encoders['Send INSTEON Extended-length Message']({
messageType: 'direct',
toAddress: command.toAddress,
- 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"