File packet.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var inherits = require("util").inherits,
EventEmitter = require("events").EventEmitter;
Function _parseField
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Packet.prototype._parseField = function(field, data, pData) {
var pField;
var width;
data = data.slice(field.from, field.to);
Function _parseData
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Packet.prototype._parseData = function(parser, payload, ds) {
var data = payload.data,
pData, fields, field;
Function _parseData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Packet.prototype._parseData = function(parser, payload, ds) {
var data = payload.data,
pData, fields, field;
- 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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Packet.prototype.parse = function(buffer) {
if (this.partialBuffer.length > 0) {
buffer = Buffer.concat(
[this.partialBuffer, buffer],
buffer.length + this.partialBuffer.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 _incParserIndex
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Packet.prototype._incParserIndex = function(i, fields, data, dsFlag, dsIndex) {
Function _parseField
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Packet.prototype._parseField = function(field, data, pData) {
var pField;
var width;
data = data.slice(field.from, field.to);
- 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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Packet.prototype.create = function(opts) {
opts = opts || {};
var sop1 = (opts.sop1 === undefined) ? FIELDS.sop1.hex : opts.sop1,
sop2 = (opts.sop2 === undefined) ? FIELDS.sop2.sync : opts.sop2,
- 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"