Showing 26 of 60 total issues
Function createPacketBuffer
has 385 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createPacketBuffer(pkt) {
if (!('xid' in pkt)) {
throw new Error('pkt.xid required');
}
Function createPacketBuffer
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
function createPacketBuffer(pkt) {
if (!('xid' in pkt)) {
throw new Error('pkt.xid required');
}
- 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 ParserFactory
has 287 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ParserFactory(protocol, Logger, assert) {
return {
logger: Logger.initialize(ParserFactory),
len: null,
Function parse
has 240 lines of code (exceeds 25 allowed). Consider refactoring. Open
parse: function(msg) {
this.len = null;
var unhandledOptions = [],
offset = 240,
File packet.js
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright (c) 2011-2014 Andrew Paprocki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Function ParserFactory
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
function ParserFactory(protocol, Logger, assert) {
return {
logger: Logger.initialize(ParserFactory),
len: 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 messageHandlerFactory
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
function messageHandlerFactory(
packetUtil,
parser,
lookupService,
configuration,
Function iscDhcpLeasePollerFactory
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
function iscDhcpLeasePollerFactory(
lookupService,
configuration,
Logger,
Promise,
Function ProtocolFactory
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function ProtocolFactory() {
var createEnum = function (v, n) {
function Enum(value, name) {
this.value = value;
this.name = name;
- 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 prepareGrunt
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prepareGrunt(grunt) {
var allFiles = [
'package.json',
'Gruntfile.js',
'lib/**/*.js',
Function messageHandlerFactory
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function messageHandlerFactory(
packetUtil,
parser,
lookupService,
configuration,
- 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 ProtocolFactory
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ProtocolFactory() {
var createEnum = function (v, n) {
function Enum(value, name) {
this.value = value;
this.name = name;
File parser.js
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright (c) 2011-2014 Andrew Paprocki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Function serverFactory
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serverFactory(core, messageHandler, IscDhcpLeasePoller, Logger) {
var logger = Logger.initialize(Server);
function Server(inPort, outPort, address) {
this.server = dgram.createSocket('udp4');
Function isBootFileNameSent
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
MessageHandler.prototype.isBootFileNameSent = function(packetData) {
var macAddress = packetData.chaddr.address;
return lookupService.macAddressToNode(macAddress)
.then(function(node) {
return node.discovered()
Function iscDhcpLeasePollerFactory
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function iscDhcpLeasePollerFactory(
lookupService,
configuration,
Logger,
Promise,
- 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 getDefaultBootfile
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
MessageHandler.prototype.getDefaultBootfile = function(packetData) {
assert.object(packetData);
assert.object(packetData.options);
assert.string(packetData.chaddr.address);
Function handleDhcpPacket
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
MessageHandler.prototype.handleDhcpPacket = function(packet, sendCallback) {
var self = this;
var packetData;
try {
Function messageHandlerFactory
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
packetUtil,
parser,
lookupService,
configuration,
taskProtocol,
Function parseLeaseData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
IscDhcpLeasePoller.prototype.parseLeaseData = function(data) {
/*
* SAMPLE ISC DHCP LEASE FILE
*
* # The format of this file is documented in the dhcpd.leases(5) manual page.