Function decode
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset) => {
const orgOffset = offset;
offset++;
const funct = buffer[offset++];
let destination;
Function encode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.encode = (buffer, funct, destination, source, hopCount, networkMsgType, vendorId) => {
const hasDestination = destination && destination.net > 0;
const hasSource = source && source.net > 0 && source.net !== 0xFFFF;
buffer.buffer[buffer.offset++] = BACNET_PROTOCOL_VERSION;
- 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 encodeTarget
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const encodeTarget = (buffer, target) => {
buffer.buffer[buffer.offset++] = (target.net & 0xFF00) >> 8;
buffer.buffer[buffer.offset++] = (target.net & 0x00FF) >> 0;
if (target.net === 0xFFFF || !target.adr) {
buffer.buffer[buffer.offset++] = 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 decode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset) => {
const orgOffset = offset;
offset++;
const funct = buffer[offset++];
let destination;
- 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
Parsing error: Invalid ecmaVersion. Open
'use strict';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/