Showing 38 of 62 total issues
File deviceCategories.js
has 2191 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
/* eslint quote-props: "off" */module.exports = {
'00': {
categoryId: '00',
categoryName: 'Generalized Controllers',
File parseInsteonCommand.js
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
const { createAllLinkRecord } = require('./allLinkRecord')
const { ENGINE_VERSION_NAMES, OUTLET_CODES, OUTLET_NAMES, X10_HOUSE_CODES, X10_UNIT_CODES, NAK_ERRORS } =
require('./constants')
const allLinkParsers = {}
File parsers.js
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
const { parseInsteonCommand } = require('./parseInsteonCommand')
const {
X10_COMMANDS, X10_HOUSE_CODES, X10_UNIT_CODES, INSTEON_MESSAGE_TYPES,
ALL_LINK_TYPES, BUTTON_EVENTS, ALL_LINK_CONTROL_NAMES,
File encodeCommand.js
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
// Also look at
// 2475SDBdev-112011-en.pdf
// 2477Sdev-072012-en.pdf
Function combineCategories
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function combineCategories (categories, categories2) {
for (const category2 of Object.values(categories2)) {
for (const device2 of Object.values(category2.subcategories)) {
const subcategories = categories[device2.categoryId] &&
categories[device2.categoryId].subcategories
- 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 createPlmBase
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const createPlmBase = ({ username, password, host, port }) => {
let hubInfo
const authHeader = () => {
const data = Buffer.from(`${username}:${password}`)
- 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 createPlmCommandQueue
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createPlmCommandQueue = (
sendCommandBuffer,
setTimeoutFn = setTimeout
) => {
/* eslint no-use-before-define: "off" */
Function createPlmStream
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createPlmStream = (plmBase, pollingInterval = 50) => {
let log = []
let monitoring
/* eslint prefer-const: "off" */
let monitor
Function createPlmBufferProcessor
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const createPlmBufferProcessor = () => {
let previousBuffer = ''
const processPlmBuffer = buffer => {
const previousBufferLength = previousBuffer.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 createPlmStream
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const createPlmStream = (plmBase, pollingInterval = 50) => {
let log = []
let monitoring
/* eslint prefer-const: "off" */
let monitor
- 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 createDevice
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function createDevice ({ id, name }) {
const properties = {
id,
name,
}
- 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 createPlmCommandStream
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createPlmCommandStream = (parsingLogger = defaultLogger) => {
let currentBuffer = ''
let previousParsedCommand
const transform = (chunk, encoding, callback) => {
Function parsePlmBuffer
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const parsePlmBuffer = (inputBuffer, previousCommand) => {
let command
const startOfText = inputBuffer.indexOf('02')
const buffer = inputBuffer.substring(startOfText)
if (startOfText < 0) {
Function createPlmCommandQueue
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const createPlmCommandQueue = (
sendCommandBuffer,
setTimeoutFn = setTimeout
) => {
/* eslint no-use-before-define: "off" */
- 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 createAllLinkDatabase
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createAllLinkDatabase = () => {
const entries = {}
const addAllLinkRecord = record => {
if (record.insteonCommand && record.insteonCommand.type === 'Record Response') {
Function parseInsteonCommand
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const parseInsteonCommand = (response, previousCommand) => {
let messageType = response.messageType
let command1 = response.command1
let command2 = response.command2
Function parseInsteonCommand
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const parseInsteonCommand = (response, previousCommand) => {
let messageType = response.messageType
let command1 = response.command1
let command2 = response.command2
- 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 createCommandAnnotator
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const createCommandAnnotator = (deviceNames) => {
const addDeviceName = command => {
if (command.fromAddress) {
command.fromDevice = deviceNames[command.fromAddress]
}
- 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 createPlmCommandStream
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const createPlmCommandStream = (parsingLogger = defaultLogger) => {
let currentBuffer = ''
let previousParsedCommand
const transform = (chunk, encoding, callback) => {
- 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 update
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const update = command => {
const propertyNames = [
'deviceCategory',
'deviceSubcategory',
'firmware',