Showing 212 of 557 total issues
Function generateKM2WebserviceResponse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async function generateKM2WebserviceResponse(requestBody) {
const isBatchRequest = Array.isArray(requestBody);
const requests = isBatchRequest ? requestBody : [ requestBody ];
const replies = [];
for (const request of requests) {
- 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 _check
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
_check(action, checker, options) {
const _this = this;
options = {
includeUndefined: true,
- 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 getListOfFiles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
static async getListOfFiles(dirname, minDatecode, maxDatecode) {
const entries = await fs.readdir(dirname, { withFileTypes: true });
const files = [];
for (const entry of entries) {
if (!entry.isFile()) {
- 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 _filterProperties
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
_filterProperties(parent, iterator) {
const _this = this;
const originalStack = _.clone(this.stack);
- 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 openSerialPort
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function openSerialPort(config) {
debugLog('Opening serial port...');
const port = await new Promise((resolve, reject) => {
const port = new SerialPort(config.path, {
Function _processType3Record
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_processType3Record(buffer, timestamp) {
const destinationAddress = buffer.readUInt16LE(14);
const sourceAddress = buffer.readUInt16LE(16);
const protocolVersion = buffer.readUInt16LE(18);
Function updateCacheForValues
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function updateCacheForValues(connection, peerAddress, cache, values) {
let knownValues = 0, unknownValues = 0;
for (const value of values) {
const { valueIndex } = cache.getValueInfoByIndexOrId(value.valueIndex, value.valueId);
if (valueIndex) {
Function _buildConfiguration
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_buildConfiguration(oldConfig) {
if (oldConfig === undefined) {
oldConfig = [];
}
Function getValueById
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
getValueById(address, valueId, options) {
const _this = this;
options = applyDefaultOptions({}, options, {
timeout: 500,
Function generateKM2WebserviceResponse
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function generateKM2WebserviceResponse(requestBody) {
const isBatchRequest = Array.isArray(requestBody);
const requests = isBatchRequest ? requestBody : [ requestBody ];
const replies = [];
for (const request of requests) {
Function startDiscoveryServices
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function startDiscoveryServices() {
debugLog('Starting discovery web service...');
const webReplyContent = [
'vendor = "RESOL"',
Function startTextLogging
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const startTextLogging = async () => {
let currentDatecode = null;
let currentConverter = null;
Function _createUInt8BlockTypeFieldSpecification
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createUInt8BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
return {
fieldId: sprintf('%s_%03d_1_0', fieldIdPrefix, offset),
name,
type: this.getTypeById(typeId),
Function filterPrefsValues
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const filterPrefsValues = function(menuSystem) {
const valueById = {};
_.forEach(menuSystem.values, (value) => {
valueById [value.id] = value;
});
Function performTransaction
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function performTransaction(connection, fn) {
let result;
logger.debug('Waiting for free bus...');
Function adjustableValues
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const adjustableValues = data.values.reduce((memo, value) => {
if (adjustableValueIds [value.id]) {
const valueTextById = {};
const addValueText = (valueText, index) => {
if (valueText.id && !hasOwnProperty(valueTextById, valueText.id)) {
Function processDownloadDownloadRequest
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const processDownloadDownloadRequest = async (req, res) => {
try {
const i18n = specification.i18n;
const startDate = req.query.startDate ? i18n.momentUtc(req.query.startDate, 'MM/DD/YYYY') : i18n.momentUtc();
- 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 startPvOutputOrgLogging
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const startPvOutputOrgLogging = async () => {
const onHeaderSet = async (headerSet) => {
const headers = headerSet.getSortedHeaders();
const packetFields = specification.getPacketFieldsForHeaders(headers);
- 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 _loadConfiguration
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async _loadConfiguration(configuration, options) {
options = {
action: 'get',
...options,
};
- 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 _createInt16BlockTypeFieldSpecification
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_createInt16BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
return {
fieldId: sprintf('%s_%03d_2_0', fieldIdPrefix, offset),
name,
type: this.getTypeById(typeId),
- 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"