Showing 217 of 365 total issues
Avoid deeply nested control flow statements. Open
} else if (service === baEnum.ConfirmedServiceChoice.CONFIRMED_COV_NOTIFICATION) {
result = baServices.covNotify.decode(buffer, offset, length);
if (!result) return debug('Received invalid covNotify message');
this.emit('covNotify', {address: address, invokeId: invokeId, request: result});
} else if (service === baEnum.ConfirmedServiceChoice.ATOMIC_WRITE_FILE) {
Function decode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
const value = {};
- 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 _performDefaultSegmentHandling
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_performDefaultSegmentHandling(sender, adr, type, service, invokeId, maxSegments, maxApdu, sequencenumber, first, moreFollows, buffer, offset, length) {
if (first) {
this._segmentStore = [];
type &= ~baEnum.PduConReqBits.SEGMENTED_MESSAGE;
let apduHeaderLen = 3;
- 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 deeply nested control flow statements. Open
} else if (service === baEnum.UnconfirmedServiceChoice.TIME_SYNCHRONIZATION) {
result = baServices.timeSync.decode(buffer, offset, length);
if (!result) return debug('Received invalid TimeSync message');
/**
Function decode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
const value = {};
let decodedValue;
let result = baAsn1.decodeTagNumberAndValue(buffer, offset + len);
- 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, apduLen) => {
let len = 0;
let result;
let decodedValue;
let requestType;
- 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 _processSegment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_processSegment(receiver, type, service, invokeId, maxSegments, maxApdu, server, sequencenumber, proposedWindowNumber, buffer, offset, length) {
let first = false;
if (sequencenumber === 0 && this._lastSequenceNumber === 0) {
first = true;
} else {
- 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, apduLen) => {
let len = 0;
const value = {};
if (apduLen <= 0) return {};
let result = baAsn1.decodeTagNumberAndValue(buffer, offset + len);
- 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 deeply nested control flow statements. Open
if (!result) return debug('Received invalid covNotifyUnconfirmed message');
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 decodeTagNumberAndValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const decodeTagNumberAndValue = module.exports.decodeTagNumberAndValue = (buffer, offset) => {
let value;
let result = decodeTagNumber(buffer, offset);
let len = result.len;
if (isExtendedValue(buffer[offset])) {
- 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 deeply nested control flow statements. Open
} else if (propertyId === baEnum.PropertyIdentifier.LIST_OF_OBJECT_PROPERTY_REFERENCES || propertyId === baEnum.PropertyIdentifier.LOG_DEVICE_OBJECT_PROPERTY || propertyId === baEnum.PropertyIdentifier.OBJECT_PROPERTY_REFERENCE) {
result = decodeDeviceObjPropertyRef(buffer, offset, maxOffset);
if (!result) return;
return {
type: baEnum.ApplicationTags.OBJECT_PROPERTY_REFERENCE,
Function byteReverseBits
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const byteReverseBits = (inByte) => {
let outByte = 0;
if ((inByte & 1) > 0) {
outByte |= 0x80;
}
- 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 deeply nested control flow statements. Open
if (!result) return;
Avoid deeply nested control flow statements. Open
if (bacappResult.encoding !== undefined) resObj.encoding = bacappResult.encoding;
Function _handlePdu
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_handlePdu(address, type, buffer, offset, length) {
let result;
// Handle different PDU types
switch (type & baEnum.PDU_TYPE_MASK) {
case baEnum.PduTypes.UNCONFIRMED_REQUEST:
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset) => {
let result;
let apduLen = 0;
const orgOffset = offset;
result = baAsn1.decodeTagNumberAndValue(buffer, offset + apduLen);
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
const value = {};
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
const value = {};
let result;
let decodedValue;
- 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
if (!result) return debug('Received invalid subscribeProperty message');