Showing 212 of 557 total issues
Function _getAdjustableValues
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getAdjustableValues() {
const data = this.constructor.configurationData;
const typeById = (data.types || []).reduce((memo, type) => {
memo [type.id] = type;
Function convertHeaderSet
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
convertHeaderSet(headerSet) {
const _this = this;
const spec = this.specification;
Function main
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function main(argv, options) {
const args = new ArgParser(argv);
function usage(message) {
args.printUsage(message, [
Function formatTextValueFromRawValue
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
formatTextValueFromRawValue(packetField, rawValue, unit) {
let textValue;
if ((rawValue !== undefined) && (rawValue !== null)) {
if (typeof unit === 'string') {
- 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 formatTextValueFromRawValueInternal
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
formatTextValueFromRawValueInternal(rawValue, unit, rootType, precision, defaultUnit) {
const unitText = unit ? unit.unitText : defaultUnit ? defaultUnit.unitText : '';
let result, textValue, format;
if ((rawValue === undefined) || (rawValue === 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
Function updateCacheForValues
has a Cognitive Complexity of 19 (exceeds 5 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) {
- 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 _createUInt32BlockTypeFieldSpecification
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
_createUInt32BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
return {
fieldId: sprintf('%s_%03d_4_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"
Further reading
Function _deserializeType
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
_deserializeType(parent, model) {
this._filterProperties(parent, function(key, child) {
switch (key) {
case 'id':
model.id = this._getStringValue(child);
Connection
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Connection extends Duplex {
/**
* Creates a new Connection instance and optionally initializes its member with the given values.
*
Function getBlockTypeSectionsForHeaders
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBlockTypeSectionsForHeaders(headers) {
const _this = this;
return headers.reduce((memo, header) => {
if (((header.getProtocolVersion() & 0xF0) === 0x10) && (header.destinationAddress === 0x0015) && (header.command === 0x0100)) {
Function storeSpecificationData
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
static storeSpecificationData(options) {
if (options === undefined) {
options = {};
}
if (options instanceof Specification) {
Function processLine
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
const processLine = function(line) {
let md;
if ((md = /^CONNECT (.*)$/.exec(line))) {
const viaTagString = md [1];
if (_this.verifyViaTag) {
Function _deserializeMenuSystem
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
_deserializeMenuSystem(parent, model) {
this._filterProperties(parent, function(key, child) {
switch (key) {
case 'language':
model.languages.push(this._deserializeLanguage(child, new models.LanguageModel()));
Function _processBuffer
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
_processBuffer(chunk, endOfStream, processRecord) {
let buffer;
if (this.rxBuffer) {
buffer = Buffer.concat([ this.rxBuffer, chunk ]);
} else {
Function _convertHeaders
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
_convertHeaders(timestamp, headers) {
const buffers = [];
const createBuffer = function(type, length, timestamp) {
const buffer = Buffer.alloc(length);
Function fields
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fields = docFields.map(docField => {
const x = +(docField.x [0]);
const y = +(docField.y [0]);
const width = +(docField.width [0]);
const height = +(docField.height [0]);
Function getBlockTypePacketSpecificationsForSections
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBlockTypePacketSpecificationsForSections(sections) {
const _this = this;
return sections.reduce((memo, section) => {
const { sectionId } = section;
Function onHeaderSet
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onHeaderSet = async (headerSet, client) => {
const headers = headerSet.getSortedHeaders();
const packetFields = specification.getPacketFieldsForHeaders(headers);
const valuesById = packetFields.reduce((memo, pf) => {
Function sendBroadcast
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async sendBroadcast(options) {
options = applyDefaultOptions({}, options, {
broadcastAddress: null,
localAddress: null,
netmask: null,
Function rewriteWebHeaderSet
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const rewriteWebHeaderSet = function(headerSet) {
const timestamp = headerSet.timestamp;
/*
* Get list of packet fields in the received packets.