Showing 212 of 557 total issues
Avoid deeply nested control flow statements. Open
if (numericValue.charAt(0) === '#') {
const valueTextId = numericValue.slice(1);
const valueText = refValue.valueTextById [valueTextId];
if (valueText !== undefined) {
numericValue = valueText;
Function generateDLxDownloadDownloadResponse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function generateDLxDownloadDownloadResponse(rawQuery) {
const query = {
source: rawQuery.source,
outputType: rawQuery.outputType,
dataLanguage: rawQuery.dataLanguage || 'en',
- 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 (channel) {
memo.push('*' + index + ':' + channel);
}
Avoid deeply nested control flow statements. Open
} else if (version === 0x20) {
if (!Header.calcAndCompareChecksum(version, buffer, start + 1, start + 15)) {
valid = false;
}
} else if (version === 0x30) {
Function startTextLogging
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const startTextLogging = async () => {
let currentDatecode = null;
let currentConverter = null;
- 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 ((md = /^CHANNEL (\d+)$/.exec(line))) {
const channelString = md [1];
const index = +channelString;
const channel = _this.channels [index];
if (_this.verifyChannel) {
Avoid deeply nested control flow statements. Open
if (buffer.length >= 26 + dataLength) {
const frameCount = Math.floor(dataLength / 7);
const frameData = Buffer.alloc(3 * 7);
buffer.copy(frameData, 0, 26, 26 + dataLength);
Avoid deeply nested control flow statements. Open
if (!Header.calcAndCompareChecksum(version, buffer, start + 1, start + 9)) {
// console.log('checksum error in header');
valid = false;
}
Avoid deeply nested control flow statements. Open
if (majorVersion === 1) {
if (this.listenerCount('packet') > 0) {
const packet = Packet.fromLiveBuffer(buffer, start, index);
packet.timestamp = new Date(timestamp);
packet.channel = this.channel;
Avoid deeply nested control flow statements. Open
if (start < index) {
const line = buffer.toString('utf8', start, index);
start = index + 1;
processLine(line);
break;
Function setPacketFieldRawValues
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
setPacketFieldRawValues(packetFields, rawValues) {
const _this = this;
const packetFieldById = packetFields.reduce((memo, packetField) => {
memo [packetField.id] = packetField;
- 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 (isPromise(channelListCallbackResult)) {
channelListCallbackResult.then(result => {
channelListCallbackDone(null, result);
}, err => {
channelListCallbackDone(err);
Avoid deeply nested control flow statements. Open
} else if (phase === 80) {
newPhase = 900;
} else if (phase === 900) {
newPhase = 1000;
}
Avoid deeply nested control flow statements. Open
if (err) {
_this.socket.destroy();
_this.socket = null;
_this._setConnectionState(TcpConnection.STATE_DISCONNECTED);
Avoid deeply nested control flow statements. Open
if (md) {
channelList.push({
channel: md [1],
name: md [2],
});
Function t
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
t(key, ...args) {
const parts = key.split('.');
const languages = [ this.language, 'dev' ];
- 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 processBlockTable
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const processBlockTable = function(blockName, tableCount, tableOffset, blockSize, cb) {
Function fetchDeviceInformation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static async fetchDeviceInformation(addressOrOptions, port) {
if (port === undefined) {
try {
return await TcpDataSourceProvider.fetchDeviceInformation(addressOrOptions, 80);
} catch (err) {
- 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 ping
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
ping(address, valueId, value, options) {
options = applyDefaultOptions({}, options, {
timeout: 500,
timeoutIncr: 500,
tries: 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
Function setValueById
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
setValueById(address, valueId, value, options) {
const _this = this;
options = applyDefaultOptions({}, options, {
timeout: 500,
- 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"