Showing 217 of 365 total issues
Function encode
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.encode = (buffer, acknowledgmentFilter, enrollmentFilter, eventStateFilter, eventTypeFilter, priorityFilter, notificationClassFilter) => {
baAsn1.encodeContextEnumerated(buffer, 0, acknowledgmentFilter);
if (enrollmentFilter) {
baAsn1.encodeOpeningTag(buffer, 1);
baAsn1.encodeOpeningTag(buffer, 0);
Function decodeTagNumberAndValue
has 30 lines of code (exceeds 25 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])) {
Function decodeCalendar
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const decodeCalendar = (buffer, offset, apduLen) => {
let len = 0;
const entries = [];
let decodedValue;
while (len < apduLen) {
Function encode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.encode = (buffer, objectId, propertyId, arrayIndex, requestType, position, time, count) => {
baAsn1.encodeContextObjectId(buffer, 0, objectId.type, objectId.instance);
baAsn1.encodeContextEnumerated(buffer, 1, propertyId);
if (arrayIndex !== baEnum.ASN1_ARRAY_ALL) {
baAsn1.encodeContextUnsigned(buffer, 2, arrayIndex);
Function decodeAcknowledge
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decodeAcknowledge = (buffer, offset) => {
let len = 0;
let result;
let decodedValue;
let isStream;
- 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 bacappDecodeApplicationData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const bacappDecodeApplicationData = module.exports.bacappDecodeApplicationData = (buffer, offset, maxOffset, objectType, propertyId) => {
if (!isContextSpecific(buffer[offset])) {
let result = decodeTagNumberAndValue(buffer, offset);
if (result) {
const len = result.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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
const value = {};
let decodedValue;
let result;
Function decode
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
const alarms = [];
Function decode
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
const value = {};
Function decode
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
const value = {};
Function byteReverseBits
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const byteReverseBits = (inByte) => {
let outByte = 0;
if ((inByte & 1) > 0) {
outByte |= 0x80;
}
Function decode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
if (apduLen < 7) return;
- 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 encode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.encode = (buffer, data) => {
baAsn1.encodeContextUnsigned(buffer, 0, data.processId);
baAsn1.encodeContextObjectId(buffer, 1, data.initiatingObjectId.type, data.initiatingObjectId.instance);
baAsn1.encodeContextObjectId(buffer, 2, data.eventObjectId.type, data.eventObjectId.instance);
baAsn1.bacappEncodeContextTimestamp(buffer, 3, data.timeStamp);
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset) => {
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
Function decode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
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 decodeAcknowledge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decodeAcknowledge = (buffer, offset, apduLen) => {
let result;
let decodedValue;
const objectId = {};
const property = {};
- 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 encodeTag
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const encodeTag = module.exports.encodeTag = (buffer, tagNumber, contextSpecific, lenValueType) => {
let len = 1;
const tmp = new Array(3);
tmp[0] = 0;
if (contextSpecific) {
- 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 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 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
Avoid deeply nested control flow statements. Open
if (!result) return debug('Received invalid writePropertyMultiple message');