lib/cluster.js
Function masterInit
has 228 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function masterInit() {
cluster.workers = {};
var intercom = new EventEmitter;
cluster.settings = {};
Function masterInit
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
Open
function masterInit() {
cluster.workers = {};
var intercom = new EventEmitter;
cluster.settings = {};
- 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
File cluster.js
has 519 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Function workerInit
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function workerInit() {
var handles = {};
// Called from src/node.js
cluster._setupWorker = function() {
Function workerInit
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
function workerInit() {
var handles = {};
// Called from src/node.js
cluster._setupWorker = function() {
- 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 setupMaster
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
cluster.setupMaster = function(options) {
var settings = {
args: process.argv.slice(2),
exec: process.argv[1],
execArgv: process.execArgv,
Function fork
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
cluster.fork = function(env) {
cluster.setupMaster();
var id = ++ids;
var workerProcess = createWorkerProcess(id, env);
var worker = new Worker({
Function queryServer
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function queryServer(worker, message) {
var args = [message.address,
message.port,
message.addressType,
message.fd];
Function rr
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function rr(message, cb) {
if (message.errno)
return cb(message.errno, null);
var key = message.key;
Function SharedHandle
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function SharedHandle(key, address, port, addressType, backlog, fd) {
Function _getServer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
cluster._getServer = function(obj, address, port, addressType, fd, cb) {
Function RoundRobinHandle
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function RoundRobinHandle(key, address, port, addressType, backlog, fd) {