Showing 212 of 557 total issues
Function getDeviceSpecification
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
getDeviceSpecification(selfAddress, peerAddress, channel) {
if (typeof selfAddress === 'object') {
if (peerAddress === 'source') {
({ channel } = selfAddress);
peerAddress = selfAddress.destinationAddress;
ValuesWrapper
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ValuesWrapper {
constructor(pattern, values) {
this.pattern = pattern;
this.values = values;
Function _convertHeaders
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
_convertHeaders(timestamp, headers) {
const buffers = [];
const createBuffer = function(type, length, timestamp) {
const buffer = Buffer.alloc(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
Function sendBroadcastIPv6
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async sendBroadcastIPv6(options) {
options = applyDefaultOptions({}, options, {
broadcastAddress: 'ff02::1',
localAddress: null,
broadcastInterface: null,
Function headersData
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
const headersData = packetInfoList.reduce((memo, packetInfo, packetInfoIndex) => {
if (packetInfo.packetFields.length >= 0) {
const fieldsData = packetInfo.packetFields.map((packetField, packetFieldIndex) => {
const fieldData = {
id: packetField.packetFieldSpec.fieldId,
File tcp-data-source-provider.js
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*! resol-vbus | Copyright (c) 2013-present, Daniel Wippermann | MIT license */
const dgram = require('dgram');
const http = require('http');
Function _convertHeaderSetToJson
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
_convertHeaderSetToJson(headerSet) {
const spec = this.specification;
const { i18n } = spec;
Function startPvOutputOrgLogging
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
const startPvOutputOrgLogging = async () => {
const onHeaderSet = async (headerSet) => {
const headers = headerSet.getSortedHeaders();
const packetFields = specification.getPacketFieldsForHeaders(headers);
Function _deserializeLine
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_deserializeLine(parent, model) {
this._filterProperties(parent, function(key, child) {
switch (key) {
case 'id':
model.id = this._getStringValue(child);
Function result
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
const result = conversions.reduce((valueInfo, conversion) => {
let { rawValue } = valueInfo;
const { sourceUnit, targetUnit } = conversion;
const unitFamily = sourceUnit && sourceUnit.unitFamily;
Function loadSpecificationData
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
static loadSpecificationData(rawSpecificationData, options) {
if (rawSpecificationData === undefined) {
rawSpecificationData = {};
}
if (options === undefined) {
Function fetchDeviceInformation
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async fetchDeviceInformation(addressOrOptions, port) {
if (port === undefined) {
try {
return await TcpDataSourceProvider.fetchDeviceInformation(addressOrOptions, 80);
} catch (err) {
Function getBlockTypeFieldsForSections
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBlockTypeFieldsForSections(sections) {
const _this = this;
const sectionByBlockTypeId = sections.reduce((memo, section) => {
memo [section.sectionId] = section;
Function transceive
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async transceive(txData, options) {
options = applyDefaultOptions({}, options, {
timeout: 500,
timeoutIncr: 0,
tries: 1,
- 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 getRawValue
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
getRawValue(pt, ptf, buffer, start, end) {
let rawValue = 0, valid = false;
for (const part of ptf.parts) {
if (start + part.offset < end) {
let partValue;
- 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 _saveConfiguration
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async _saveConfiguration(newConfiguration, oldConfigurstion, options) {
options = {
action: 'set',
actionOptions: {
save: 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 getPacketSpecification
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
getPacketSpecification(headerOrChannel, destinationAddress, sourceAddress, command) {
if (typeof headerOrChannel === 'object') {
({ command, sourceAddress, destinationAddress } = headerOrChannel);
headerOrChannel = headerOrChannel.channel;
} else if (typeof headerOrChannel === 'string') {
Function _deserializeValue
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
_deserializeValue(parent, model) {
this._filterProperties(parent, function(key, child) {
switch (key) {
case 'id':
model.id = this._getStringValue(child);
Function handleVBus
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function handleVBus(connection, selfAddress, state) {
let lastResistor = -1;
while (true) {
const rxPacket = await connection.transceive(null, {
Function _createInt16BlockTypeFieldSpecification
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createInt16BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
return {
fieldId: sprintf('%s_%03d_2_0', fieldIdPrefix, offset),
name,
type: this.getTypeById(typeId),