Showing 217 of 365 total issues
File enum.js
has 2069 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
module.exports.PDU_TYPE_MASK = 0xF0;
module.exports.ASN1_MAX_OBJECT = 0x3FF;
module.exports.ASN1_INSTANCE_BITS = 22;
File asn1.js
has 1528 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
const iconv = require('iconv-lite');
const baEnum = require('./enum');
File client.js
has 798 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
// Util Modules
const EventEmitter = require('events').EventEmitter;
const debug = require('debug')('bacstack');
Function bacappDecodeContextApplicationData
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
const bacappDecodeContextApplicationData = (buffer, offset, maxOffset, objectType, propertyId) => {
let len = 0;
let result;
if (isContextSpecific(buffer[offset])) {
if (propertyId === baEnum.PropertyIdentifier.LIST_OF_GROUP_MEMBERS) {
- 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 _processConfirmedServiceRequest
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
_processConfirmedServiceRequest(address, type, service, maxSegments, maxApdu, invokeId, buffer, offset, length) {
let result;
debug('Handle this._processConfirmedServiceRequest');
if (service === baEnum.ConfirmedServiceChoice.READ_PROPERTY) {
result = baServices.readProperty.decode(buffer, offset, length);
- 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
File service-read-property.spec.js
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
const utils = require('./utils');
const baServices = require('../../lib/services');
const baEnum = require('../../lib/enum');
Client
has 49 functions (exceeds 20 allowed). Consider refactoring. Open
class Client extends EventEmitter {
constructor(options) {
super();
options = options || {};
Function decodeReadAccessResult
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
const decodeReadAccessResult = module.exports.decodeReadAccessResult = (buffer, offset, apduLen) => {
let len = 0;
const value = {};
if (!decodeIsContextTag(buffer, offset + len, 0)) return;
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 bacappDecodeContextApplicationData
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
const bacappDecodeContextApplicationData = (buffer, offset, maxOffset, objectType, propertyId) => {
let len = 0;
let result;
if (isContextSpecific(buffer[offset])) {
if (propertyId === baEnum.PropertyIdentifier.LIST_OF_GROUP_MEMBERS) {
Function bacappContextTagType
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
const bacappContextTagType = (property, tagNumber) => {
let tag = 0;
switch (property) {
case baEnum.PropertyIdentifier.ACTUAL_SHED_LEVEL:
case baEnum.PropertyIdentifier.REQUESTED_SHED_LEVEL:
Function encode
has 108 lines of code (exceeds 25 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);
Function _processUnconfirmedServiceRequest
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
_processUnconfirmedServiceRequest(address, type, service, buffer, offset, length) {
let result;
debug('Handle this._processUnconfirmedServiceRequest');
if (service === baEnum.UnconfirmedServiceChoice.I_AM) {
result = baServices.iAmBroadcast.decode(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
Function _processConfirmedServiceRequest
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
_processConfirmedServiceRequest(address, type, service, maxSegments, maxApdu, invokeId, buffer, offset, length) {
let result;
debug('Handle this._processConfirmedServiceRequest');
if (service === baEnum.ConfirmedServiceChoice.READ_PROPERTY) {
result = baServices.readProperty.decode(buffer, offset, length);
Function decode
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset) => {
let len = 0;
let result;
let decodedValue;
const eventData = {};
Function decode
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
let requestType;
Function decodeReadAccessResult
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
const decodeReadAccessResult = module.exports.decodeReadAccessResult = (buffer, offset, apduLen) => {
let len = 0;
const value = {};
if (!decodeIsContextTag(buffer, offset + len, 0)) return;
len++;
Function decodeCovSubscription
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
const decodeCovSubscription = (buffer, offset, apduLen) => {
let len = 0;
const value = {};
let result;
let decodedValue;
Function decode
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
let objectId;
- 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 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.decodeAcknowledge = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
const value = {};
Function decode
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
module.exports.decode = (buffer, offset, apduLen) => {
let len = 0;
let result;
let decodedValue;
if (!baAsn1.decodeIsContextTag(buffer, offset + len, 0)) 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"