Showing 62 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
direct('2E', 'Light ON at Ramp Rate', ({ command, response }) => {
const command2 = response.command2
command.onLevel = decodeOnLevel(command2.substring(0, 1))
command.rampRate = decodeRampRate(command2.substring(1, 2))
return command
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 87.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
directAck('2E', 'Light ON at Ramp Rate', ({ command, response }) => {
const command2 = response.command2
command.onLevel = decodeOnLevel(command2.substring(0, 1))
command.rampRate = decodeRampRate(command2.substring(1, 2))
return command
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 87.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
directAck('33', 'Outlet OFF', ({ command, previousCommand }) => {
const previousCommand2 = previousCommand ? previousCommand.command2 : '--'
command.command = `Outlet OFF (${OUTLET_NAMES[previousCommand2]})`
return command
})
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
directAck('32', 'Outlet ON', ({ command, previousCommand }) => {
const previousCommand2 = previousCommand ? previousCommand.command2 : '--'
command.command = `Outlet ON (${OUTLET_NAMES[previousCommand2]})`
return command
})
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
addImParser('6B', 'Set IM Configuration', 4, (response, buffer) => {
response.imConfigurationFlags =
parseImConfigurationFlags(buffer.substring(0, 2))
response.ack = buffer.substring(2, 4) === '06'
return response
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
addImParser('7B', 'Set RF Frequency Offset', 4, (response, buffer) => {
response.refFrequencyOffset = parseSignedInt(buffer.substring(0, 2))
response.ack = buffer.substring(2, 4) === '06'
return response
})
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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"